In traditional coding of Zend based programs, the database configurations are saved within the application.ini . This stores the configurations on the per application basis.

Has anybody here on StackOverflow investigated the potential of moving database configurations in the application.ini in to the atmosphere? For instance, a fundamental way could be storing possibly database connections configurations within the Apache2 envvars file or even in something similar to /etc/profile or /etc/atmosphere .

You will find a few explanations why I must do that:

1) There's security risk where getting live, production database configurations inside the application. Designers could inadvertedly connect with the live database and damage customer sensitive data. This could safeguard both designers, the company an clients.

2) It is not easy to keep and manage the db configurations of multiple programs. For instance, if your username or password changes for any database, only then do we will have to alter the application.ini or multiple programs that will mean a rollout of exactly that file or even the whole application again.

3) A credit card applicatoin might be used to mulitple 'production' conditions in which the database configurations differ. Therefore there might have to be multiple sections inside the application.ini - for instance and production-datacentreX, production-datacentreY.

As you can tell, there's a disagreement on keeping database configurations around the server side. Therefore, it might be easier to have probably the database configurations outdoors a credit card applicatoin inside a global position for all programs to gain access to? This is in it's own source control possibly that might be unaccessible to designers.

Exactly what do you folks think? Anybody done such like? I like the thought of the global application.ini (possibly known as database.ini?)

Searching toward hearing some reactions about them.

Regards,

Steve

During my last project I have done such like. I've application.ini that is saved in repository and consists of common configurations for application (view configurations, assistants path, enable layout and such things as that). But, each demonstration of application (each developer has one of these + testing and development server) features its own local.ini file (which isn't versioned) with database configurations and development directives (enabling FirePHP, ZFDebug). Because of that solution, we are able to make changes "globally" - application.ini and every designers can alter configurations "in your area" - using local.ini file.

In Bootstrap.php I merge them like below:

protected function _initLocalConfig()
{
    $globalConfig = new Zend_Config($this->getOptions(), true);
    try {
        $localConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/local.ini');
        $globalConfig->merge($localConfig);
        $this->setOptions($globalConfig->toArray());
    } catch (Zend_Config_Exception $e) {
        throw new Exception('File /configs/local.ini not found. Create it, it can be empty.');
    }
} 

I am using second static named .ini file here, in another project we use .ini files according to host names. They may be also JSON, XML or YAML files (to make the most of built-in Zend_Config parsers) or write your personal adapter.

As if you see, you are able to take your non-common config practically everywhere you would like :)