Skip to content

@BinaryMuse /config_application.yml secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# All values should be specified in "default". Anything
# that is specified in any other environment--"test", "development",
# or "production"--will overwrite values in "default".
default:
allow_registration: false
facebook:
app_id: APP_ID_HERE
app_secret: APP_SECRET_HERE
api_key: API_KEY_HERE
twitter:
api_key: API_KEY_HERE
oauth_consumer_key: CONSUMER_KEY_HERE
oauth_consumer_secret: CONSUMER_SECRET_HERE
development:
allow_registration: true
test:
allow_registration: true
require 'yaml'
# ERB.new allows us to use ERB tags in the YAML
yaml_data = YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'application.yml'))).result)
# Merge the "default" section with the section for this environment
config = yaml_data["default"]
begin
config.merge! yaml_data[Rails.env]
rescue TypeError
# nothing specified for this environment; do nothing
end
# Pass to a HashWithIndifferentAccess so that we can use symbols (APP_CONFIG[:key])
APP_CONFIG = HashWithIndifferentAccess.new(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.