Skip to content

Instantly share code, notes, and snippets.

@TrevorS
Created May 1, 2015 16:01
Show Gist options
  • Save TrevorS/520204ed2ac121ee7494 to your computer and use it in GitHub Desktop.
Save TrevorS/520204ed2ac121ee7494 to your computer and use it in GitHub Desktop.
# Global Configuration
def load_config(file)
File.exist?(file) ? YAML.load_file(file) : {}
end
def rails_platform
if Rails.env.production?
ENV['PLATFORM'] != 'production' ? :staging : :production
else
Rails.env.to_sym
end
end
defaults = load_config(Rails.root.join('config', 'application.default.yml'))
settings = load_config(Rails.root.join('config', 'application.yml'))
CONFIG = defaults.deep_merge(settings).deep_symbolize_keys[rails_platform]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment