Tweak config implementation.

To place the configs and their default values front-and-center and in a
first-class way. Helper logic extracted and moved to the bottom.
Implement API middleware foundation. Part of #4.