Welcome Guest, Not a member yet? Register   Sign In
Environment dependent configuration
#1

[eluser]thomasz[/eluser]
I have some configuration files that are different from different environments (Dev, Test, Production). I am trying to figure out the best way to manage this without having to track multiple versions of the config files.

What I tried was to create an environment value in the main config.php. Such as this:
$config['environment'] = 'DEV'; //valid values are DEV, TEST, PROD

Then in an application config file myapp_config.php I could check the evironment:
if ($config['environment'] == 'PROD') {
$config['value'] = 'value 1';
else {
$config['value'] = 'value 2';
}

However this blew up on the "if $config['environment']" since environment is not defined. Does anyone know either:
a) how best to solve the problem of environment dependent variables or
b) how to reference a config within another config

Thanks
Thomas


Messages In This Thread
Environment dependent configuration - by El Forum - 12-09-2008, 12:43 PM
Environment dependent configuration - by El Forum - 12-09-2008, 01:07 PM
Environment dependent configuration - by El Forum - 12-09-2008, 01:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB