Reputation: 354
In the sceleton application that I've downloaded from github there is a file module/Application/config/module.config.php
return array(
'layout' => 'layout/layout.phtml',
'display_exceptions' => true,
'di' => array(
'instance' => array(
'alias' => array(....
this file is used in module/Application/module.php:
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
How to create 3 different configs depending on domain (production, staging, development)? It seems in ZF1 env vars has been used, but I don't know how to do that in zf2 module. Thank you!
Upvotes: 11
Views: 3773
Reputation: 12778
Create a file called development.config.php
in application/config/autoload
and this will be loaded after all the modules' config files have been loaded. As a result, you can override anything the merged configuration by adding the relevant keys to this file.
The name of the file loaded is {APPLICATION_ENV}.config.php
, so you can create production.config.php
, etc.
Note that you may have to change the glob in index.php
as it's unclear if the Skeleton application will work out of the box with APPLICATION_ENV or not at this stage of the development of ZF2 (early April 2012).
Upvotes: 9
Reputation: 8519
it seems to work with a simple .htaccess change. :
SetEnv APPLICATION_ENV development
I don't know if staging will work, but production and development work out of the box. I think it works through the event listener, but don't ask me how, I haven't gotten that far yet.
Upvotes: 4