Where to store config parameters?
Asked Answered
F

2

8

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?

Fortitude answered 19/9, 2017 at 20:47 Comment(2)
It is assumed that the environment in which the application runs is providing the necessary configurations. However, often it does make sense to store this configuration in version control, for the usual reasons.Socinus
I want to link the same question instances: 1. #44656819 2. #53709364 3. #41203407Cosy
S
-4

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

Sequacious answered 25/11, 2017 at 8:27 Comment(1)
I would agree it is out of the scope of 12factors to provide the answer. And this is likely why @Fortitude is asking this question here, because even though it is out of the 12factors scope, it is still a question that needs to be answered for real projects.Recumbent
A
1

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.

Amero answered 20/12, 2021 at 10:51 Comment(0)
S
-4

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

Sequacious answered 25/11, 2017 at 8:27 Comment(1)
I would agree it is out of the scope of 12factors to provide the answer. And this is likely why @Fortitude is asking this question here, because even though it is out of the 12factors scope, it is still a question that needs to be answered for real projects.Recumbent

© 2022 - 2024 — McMap. All rights reserved.