Moved environmentfile out of config/initializers, since it is getting loaded too late for the active_admin initializer (sic), and back to lib whilst putting the reference to the lib file in application.rb so as it is loaded prior to any of the initializers, particularly active_admin.