Created
October 10, 2012 22:17
-
-
Save notapatch/3868837 to your computer and use it in GitHub Desktop.
Loading application specific environmental variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GMAIL_USERNAME: [email protected] | |
GMAIL_PASSWORD: my_secret_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Good Rails Cast Episode on it | |
# http://railscasts.com/episodes/85-yaml-configuration-file?view=similar | |
ScheduleGardener::Application.configure do | |
require 'yaml' | |
yaml_data = YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'sensitive_information.yml'))).result) | |
APP_CONFIG = HashWithIndifferentAccess.new(yaml_data) | |
# could be used anywhere in program (I think) but I'm using it in developement.rb as I needed it for configs occurring # there. Application is read in before initializers so don't have many choices about when to load | |
user_name: APP_CONFIG[:GMAIL_USERNAME], | |
password: APP_CONFIG[:GMAIL_PASSWORD] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment