This looks generally useful. Could you move that to the configuration module?