public
Last active — forked from jnunemaker/harmony.rb

  • Download Gist
harmony.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(Rails.root + "/config/harmony.yml")
@config = YAML.load(raw_config)[Rails.env].symbolize_keys
end
@config[key]
end
def self.[]=(key, value)
@config[key.to_sym] = value
end
end
harmony.yml
YAML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
DEFAULTS: &DEFAULTS
email: no-reply@harmonyapp.com
email_signature: |
Regards,
The Harmony Team
 
development:
domain: harmonyapp.local
<<: *DEFAULTS
test:
domain: harmonyapp.com
<<: *DEFAULTS
 
production:
domain: harmonyapp.com
<<: *DEFAULTS

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.