Configuration

By Artyom Kazak aka @availablegreen
Last update: January 5, 2021

Config files

Either YAML or Dhall.

Dhall is a language for typed, programmable configs. Which are a great idea, because:

  • types give the user at least some documentation for free,
  • that documentation doesn't go out of date, and
  • when you notice repetition, you aren't tempted to devise some clever way to make it go away — you know the user can just write a function if they want.

Unfortunately, I don't like Dhall as much as I'd want to. I don't like the formatter that messes up with my configs, I don't like that I have to encode JSON in a weird way, I don't like that I can't easily pass my own primitives to the interpreter. I'd love something that lets me shoot myself in the foot a bit more easily.

So nowadays I default to YAML unless I have time to spend. I might start using TOML instead of YAML at some point because it has fewer gotchas around syntax.

Environment variables

envy looks good.

Usually I just use getEnv, but 'envy' looks strictly better so I will probably use it the next time I need to grab environment variables.