Skip to content

Instantly share code, notes, and snippets.

@dewski
Created April 16, 2011 04:29
Show Gist options
  • Save dewski/922868 to your computer and use it in GitHub Desktop.
Save dewski/922868 to your computer and use it in GitHub Desktop.
# Load application configuration
require 'ostruct'
require 'yaml'
config_path = File.expand_path('config/settings.yml', Rails.root)
begin
config = YAML.load_file(config_path)
rescue Errno::ENOENT
raise "Make sure the settings file #{config_path} exists."
end
Settings = OpenStruct.new(config[Rails.env])
# Settings.email['webmaster'] # => [email protected]
# Settings.fb_app_id # => 12334155661
defaults: &defaults
host: 'localhost'
fb_app_id: 12334155661
email:
webmaster: '[email protected]'
careers: '[email protected]'
development:
<<: *defaults
host: 'bkwld.dev'
staging:
<<: *defaults
host: 'staging.bkwld.com'
test:
<<: *defaults
production:
<<: *defaults
host: 'bkwld.com'
fb_app_id: 12345678910
email:
webmaster: '[email protected]'
careers: '[email protected]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment