I have a large php project that relies on two levels of configuration files.
In my project folder, I have a default.config.ini file that loads and then merges with the site-specific configuration file.
Currently, the code is reading an environment variable PROJECT_CONFIGthat points to a specific configuration file. This is great for every 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.
Now we can no longer use the global env var, since it must be different from each subdomain (the project is installed as dev.domain.com, stage.domain.com and www.domain.com).
I looked at converting a server variable HTTP_HOSTto env var and using this to set the correct configuration (that is, when a user requested a page from dev.domain.com, the code would look for env var called dev_domain_com), but I wanted to see what others were doing people and what they recommend.
Any advice would be greatly appreciated, thanks in advance
junkalf2
source
share