← Back to home

App Configuration 4

I’m experimenting now with a following data structure for app configuration. Using JSON for simplicity:

{
  "exception_reporting": {
    "value": false,
    "overrides": {
      "dev": false,
      "prod": true
    },
    "env_var_override": "MY_EXCEPTION_REPORTING"
  },
  ...
}

I like that it’s self-contained:

Previously I’ve considered spreading default value, overrides and environment variable overrides into separate hashmaps, but that’s a disaster for extensibility because a maintainer needs to remember to check three places.

Last edited on Jun 29, 2019