Moved configuration handling to a module.

This fix the scope issue, the configuration is now globally availble.