I have a large php project that relies on two levels of config files.
In my project folder I have a default.config.ini that is loaded and then merged with a site specific config file.
At the moment the code is reading an environment variable PROJECT_CONFIG
that points to the specific config file. This works fine for each developer working on their own machine. The problem arises when we move the project to the server and want to have three instances of the same project: Dev, Stage, Live.
We now no longer can use the global env var since it needs to be different of each subdomain (project is setup as dev.domain.com, stage.domain.com and www.domain.com).
I have considered converting the server variable HTTP_HOST
into an env var name and using that to set the right config (i.e. when a user requested a page from dev.domain.com, the code would look for an env var called dev_domain_com
), but I wanted to see what other people are doing and what they recommend.
Any advice would be greatly appreciated, thanks in advance