I'm writing a thesis about twelve-factor apps and I wonder if you can help me out here.
The third factor of twelve-factor apps states: Store config in the environment. (https://12factor.net/config). According to the page all configuration which might vary between deploys should be extracted to environment variables.
I am wondering how to apply during development when creating e.g. a Rails app. Currently I see two ways which are both not perfect in my opinion.
- Store environment variables in a file like .bashrc or .zshrc. I don't have a good idea on how to manage a test and development environment using this approach since both need a specific configuration using the same environment variables. Also when working on multiple projects this will clutter the shell with variables but it seems to be compliant with the twelve-factor app methodology.
- use a tool like https://github.com/bkeepers/dotenv which uses a file which is part of the project to store the configuration and is thereby not so much different from secrets.yml or database.yml which the Rails framework already offers and which is not perfectly compliant to the twelve-factor app idea (can still be accidentally checked into the codebase and is mostly language-agnostic)
Is my view correct? I wonder if there are any best practices to tackle this problem.
Thanks!