Database config for multiple environments (development, qa, production, etc.)
Permalink
What is the preferred method of handling multiple development environments, as far as the database config? Can anyone shine some light? Basically, what I want to ensure is that when on QA, one database connection settings are used, and on production, the production settings are used.
Thank you.
Thank you.
I'd use git and ignore /config/database.php so that file on qa and production is never overwritten.
That definitely would work, although if you use something like Capistrano for deployments, it would be an extra step every time I deployed to re-create that file (unless I created it as part of the deployment). Capistrano deploys what is in GIT, so if that file wasn't in GIT, after deploying every time I'd have to recreate the database.php file.
In the past, I would set an environment variable in Apache, and as part of my Concrete setup, after installing the site for the first time, I'd edit site.php to read that environment variable, and load the appropriate config file. So, in /config, I'd have an /environments folder, with development.php, qa.php, and production.php files holding the specific database connection settings.
This post references a method where the config is loaded based on the hostname of the server. So you could have a local.database.php, and a myqahost.database.php, etc. But I can't get it to work. It doesn't seem to read my file, which is something like "Blakes-MacBook-Pro.local.database.php". Tried that, and also "local.database.php", but no luck. It just goes to the install screen.
https://www.concrete5.org/community/forums/5-7-discussion/environmen...
In the past, I would set an environment variable in Apache, and as part of my Concrete setup, after installing the site for the first time, I'd edit site.php to read that environment variable, and load the appropriate config file. So, in /config, I'd have an /environments folder, with development.php, qa.php, and production.php files holding the specific database connection settings.
This post references a method where the config is loaded based on the hostname of the server. So you could have a local.database.php, and a myqahost.database.php, etc. But I can't get it to work. It doesn't seem to read my file, which is something like "Blakes-MacBook-Pro.local.database.php". Tried that, and also "local.database.php", but no luck. It just goes to the install screen.
https://www.concrete5.org/community/forums/5-7-discussion/environmen...
Yes, I've tried:
...and also...
And in /config/local.database.php, I have:
...and also...
And in /config/local.database.php, I have:
After finding this tutorial, I have it working:
http://documentation.concrete5.org/tutorials/loading-configuration-...
http://documentation.concrete5.org/tutorials/loading-configuration-...