Support using environmental variables in config.

Adds support for #1023
More debug output.