Where to store config parameters?

Viewed 653

Reading Config section for 12 factor app : https://12factor.net/config it states "Another approach to config is the use of config files which are not checked into revision control" . Instead "The twelve-factor app stores config in environment variables " If not store config in source/revision control then where should config for environment variables be stored ?

For example a new developer joins a team how does that same developer access the environment variables in order to run the app ? Is it assumed an environment is provided that contains variables that allows app to run?

2 Answers

The suggestion to “use of config files which are not checked into revision control” is probably a little misleading. You could read it as “config files which are not revisioned together with the app”.

That means you can use revision X of the app with revision Y and revision Z of the configuration (or maybe even an unrevisioned configuration), and can use revision X1 and X2 of the app with revision Y of the configuration.

What is addressed that some apps have configuration baked in, so that for example you need a different release for staging and production.

How you would store the configuration is a detail that isn't addressed in detail. You could use ConfigMaps on Kubernetes (which can be consumed as environment variables), store configuration in a database (i.e. etcd), use Hashicorp Vault and Consul or store them in git (i.e. GitOps).

Generally there will be static parts of you configuration (i.e. tax rates) and dynamic one (i.e. names or IP addresses of external services). You don't have to store everything in one place, and defining some of the on the same git server as you app is totally fine. Whether your app accessed the configuration on the git server or gets it injected via another mechanism is up to your deployment methods.

Where to store these is beyond the scope of 12factors, the important thing is to decouple the source repository from deployment specific data.

Related