Answer the question
In order to leave comments, you need to log in
How to store configs in a repository?
There is a repository in which site files are stored.
A development team works with the site and it is necessary to store two versions of the configuration files - one for developers with a certain set of simple passwords and one for production with complex passwords and other logins.
We are talking about authorization settings in MySQL, remote FTP and other things.
Question - tell me how best to organize the storage of both configs for production and for developer servers.
Answer the question
In order to leave comments, you need to log in
I do this: the config for developers or an empty config is stored in the git repository. The production config is stored outside of git on the server. When deploying, a symlink is simply made.
Make two files - config.ext and config.local.ext, keep only the first one under version control, put the second on the ignore list.
Teach the application to read both files with settings priority from the second one.
In the second, override only locally different password type settings.
Then, when adding new settings or changing old ones, it will not be necessary to touch the “local” configs at all.
What prevents you from using a separate repository for configs with branches for production and others, and connecting them to the main repository using git submodule? Of course, this will be handy if you are not already using the submodule, then you need to be more careful when starting git submodule update
.
config.default for default settings and empty config.local for local, config.local in .gitignore. The application first reads config.default, and then overrides some settings from config.local This is if I do not use a framework in which this problem has already been solved.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question