4 ms·
Reading this, I doubt it can be taken as gospel. > Store config in the environment How do you pass hierarchical config? In JSON, YAML, TOML, etc., it's easy t
by LockAndLol 6y ago
Reading this, I doubt it can be taken as gospel.
> Store config in the environment
How do you pass hierarchical config? In JSON, YAML, TOML, etc., it's easy to group env vars, but how do you do that with env vars? LOGGING__HANDLER__FORMAT, LOGGING__HANDLER__ARGS__ARG1, LOGGING__HANDLER__ARGS__ARG2 ? If so, that looks positively awful. If the solution is passing a YAML or JSON string in the env variable, that sounds even worse than having a config file that the app reads.
>> it’s easy to mistakenly check in a config file to the repo
Add it to the ignore file. Someone would really have to force commit it to get into version control. Plus, even if it's stored in env vars, you're going to commit the values somewhere be it your Ansible secrets, SaltStack yml, Chef or Puppet repo, whatever.
To be fair, that's the only point I contend with. The rest is very reasonable.
- mdaniel 6y ago> How do you pass hierarchical config? In JSON, YAML, TOML, etc., it's easy to group env vars, but how do you do that with env vars? Spring Boot approaches that problem via `SPRING_APPLICATION_JSON` (and likely `SPRING_APPLICATION_YAML` but I haven't personally tried it) containers: - name: web image: whatever env: - name: SPRING_APPLICATION_JSON # language=json value: | {"spring": {"logging": {"level": "debug"}}}
- LockAndLol 6y agoGoodness gracious. That's dreadful and exactly what I feared the effect of that rule would be were it followed strictly. It looks like a hacky workaround to an unnecessary problem.
- erulabs 6y agoI’ve always thought a reasonable pragmatic solution is to force configuration files to be loaded based on an optional env variable. Kubernetes can easily mount a complex configuration file via a volume or configmap (configmapgenerator is awesome). As long as the path is configurable and the env var is documented - it’s not so bad.