Refactor configuration

This puts all the configuration bits into the `config` module.  Also,
every relevant configuration can now be set via a respective environment
variable.