I’ve just released version 1 of the ContextConfig library on GitHub as well as an umbraco package.

This C# library allows you to set configuration values dependent upon which web server environment the code is currently running using a basic XML config file.

Environments are defined using the hostname (url) from which the page is operating. Multiple hostnames can be set for each environment. You can also add an optional "catch-all" wildcard domain indicating which environment should be assumed if the current domain doesn't match any that have been predefined.

Here’s a quick demo of the functionality.