class MuchKeys::Rails < Rails::Railtie config.before_configuration do MuchKeys.configure do |config| config.application_name = Rails.application.class.parent_name.underscore end MuchKeys.populate_environment!(*env_keys) end def env_keys # parse all environments found in .env and populate them from consul unless File.exists?(Rails.root.join(".env")) raise IOError, ".env files are required for Muchkeys ENV injection to work" end File.read(Rails.root.join(".env")).each_line.map { |x| x.split("=")[0] } end end