3 ms·
> Configuration needs to have cascading levels to make life easiest in dev, test and production without enormous setup time. The backdrop of when the 12factor
by schneems 3y ago
> Configuration needs to have cascading levels to make life easiest in dev, test and production without enormous setup time.
The backdrop of when the 12factor app was written is that you can toggle modes like that with RAILS_ENV=test (an environment variable).
One way I think of the config section is “does your config strategy play well with containers?” Once you build an image you have a static disk state that doesn’t persist changes unless you make a new image. If your config is file based (only), then to toggle between test and production behavior you would have to build a whole new image.
By allowing config to change without the underlying disk, it helps to isolate changes. Did the app break because something in the deploy (image generation) broke? Or is it a bad config? If you decouple image generation from configuration changes it eliminates that question.
- ahtihn 3y ago> Once you build an image you have a static disk state that doesn’t persist changes unless you make a new image. If your config is file based (only), then to toggle between test and production behavior you would have to build a whole new image. You could mount a volume with the config file. The nice thing is that this lets you change the config at runtime (assuming the app watches for file changes). Env vars cannot be changed at runtime.
- schneems 3y ago> Env vars cannot be changed at runtime You can specify env vars any time you boot up an image. I see this as a benefit. I use containers for production and don’t want wild ssh yolo modifications. I want to have very clear immutable inputs. > mount a volume with the config file Sure, but where? And what if you need multiple files for multiple different things to configure? What’s to prevent someone from accidentally putting non config files into that volume or accidentally changing the permissions on the file or any other host of things that we just don’t have to reinvent if we use env vars.