This is starting to make me tear my hair out. I've worked with NSM config bootstrap (http://ee-garage.com/nsm-config-bootstrap) on several sites now. It enables you to set your database connection details in the bootstrap file, which should override database.php, and they change depending on which server environment you're looking at. The issue I'm having is that changing my connection settings in the bootstrap file isn't overwriting the settings in database.php, so I'm getting connection errors on either the local or the stage, depending on what I put in database.php. My file structure is:
system
expressionengine
config
config.php
database.php
config_bootstrap.php
At the bottom of config.php and database.php I have this line:
require_once(realpath(dirname(__FILE__) . '/config_bootstrap.php'));
The relevant part of my bootstrap file looks like this:
// Define the environment settings
$env_config = array();
$env_db_config = array();
$env_global_vars = array();
// Set the environmental config and global vars
if (NSM_ENV == 'local') {
$env_db_config = array(
'hostname' => 'localhost',
'database' => 'database',
'username' => 'username',
'password' => 'password',
);
$env_global_vars = array(
'global:cm_subscriber_list_slug' => ''
);
}
elseif(NSM_ENV == 'staging') {
$env_db_config = array(
'hostname' => 'localhost',
'database' => 'database',
'username' => 'username',
'password' => 'password',
);
$env_global_vars = array(
'global:cm_subscriber_list_slug' => ''
);
$env_config = array(
'webmaster_email' => 'webmaster@' . NSM_SERVER_NAME,
'webmaster_name' => 'Webmaster',
);
}
else {
$env_db_config = array(
'hostname' => '',
'database' => '',
'username' => '',
'password' => '',
);
$env_global_vars = array(
'global:cm_subscriber_list_slug' => '',
'global:google_analytics_key' => 'XX-XXXX'
);
}
I know the bootstrap file is being included, as it's also setting things like my template directory and file upload paths etc correctly, it appears that it's just the database settings that it's not overriding. I thought it may be permissions, but database and config files are 666, so it should be ok.
Please let me know what other information I need to include if this isn't enough.