I add an optional config file which combined with the merge feature from Zend_Config allows me to override any config setting for each server name. To do it I only have to modify a little the index.php file:
@@ -17,10 +17,23 @@ set_include_path(implode(PATH_SEPARATOR, array(
/** Zend_Application */
require_once 'Zend/Application.php';
+/** Config **/
+if (is_file(APPLICATION_PATH . '/configs/' . $_SERVER['HTTP_HOST']. '.ini')) {
+ require_once 'Zend/Config/Ini.php';
+ $config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/application.ini', APPLICATION_ENV, true);
+ $localConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/' .
$_SERVER['HTTP_HOST']. '.ini', APPLICATION_ENV);
+ $config->merge($localConfig);
+ unset($localConfig);
+ $config->setReadOnly();
+} else {
+ $config = APPLICATION_PATH . '/configs/application.ini';
+}
+
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
- APPLICATION_PATH . '/configs/application.ini'
+ $config
);
+
$application->bootstrap()
->run();
\ No newline at end of file
El 26/10/2010 19:30, Henry Umansky escribió:
> On Oct 26, 2010, at 12:01 PM, Frank DiRocco wrote:
>
>> Henry,
>>
>> Have you tried loading the config? I do something like this in my 1.10.x
>> bootstrap _inits, the ini file is compiled just like application.ini
>>
>> $config = new Zend_Config_Ini('path/to/yourDbSchemaCredentials.ini',
>> 'dbsecrets');
>>
>> Just keep in mind, your credentials will be available/accessible in this
>> $config variable
>>
> I was playing around with creating an application.ini.sample with dummy data
> that will be stored in my subversion repo, then when I deploy using
> Capistrano, I create a symbolic link from my "shared" folder application.ini
> file to the current document root. The problem with this mechanism is that I
> need to duplicate my local application.ini config file 3 times; once on my
> local development server, then on the staging server, then eventually
> production. Syncing the file between the three servers might be a hassle, but
> hopefully, I don't need to change it too often. Anyone else come up with a
> better solution?
>
> -Henry
>
signature.asc
Description: OpenPGP digital signature
