Created
December 29, 2011 08:41
-
-
Save hmcfletch/1532985 to your computer and use it in GitHub Desktop.
Rails project wide and personal configuration files
This file contains hidden or 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
| require File.expand_path('../boot', __FILE__) | |
| require 'rails/all' | |
| module MyApp | |
| class Application < Rails::Application | |
| # you app configuration code | |
| end | |
| end | |
| { :config => :CONFIG, | |
| :database => :DATABASE, | |
| :facebook => :FACEBOOK, | |
| :mailer => :MAILER, | |
| :paypal_adaptive => :PAYPAL, | |
| :s3 => :S3 }.each_pair do |file_name, variable_name| | |
| config = YAML.load_file(File.join("#{Rails.root.to_s}/config", "#{file_name}.yml"))[Rails.env].symbolize_keys # Load in the defaults. | |
| override = File.join("#{Rails.root.to_s}/config", "#{file_name}.personal.yml") # Check for personal settings. | |
| config.merge!(YAML.load_file(override)[Rails.env].symbolize_keys) if File.exists?(override) | |
| self.class.const_set(variable_name, config) | |
| end | |
| # generates the following global constants: | |
| # CONFIG | |
| # DATABASE | |
| # MAILER | |
| # PAYPAL | |
| # S3 | |
| # don't forget to add config/*.personal.yml to your .gitignore |
This file contains hidden or 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
| development: | |
| name: MyTotallySweetName | |
| host: lvho.st:3000 | |
| user_dev_tweaks: true |
This file contains hidden or 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
| test: | |
| name: AppName | |
| host: 127.0.0.1:3000 | |
| development: | |
| name: AppName | |
| host: lvho.st:3000 | |
| user_dev_tweaks: false | |
| production: | |
| name: AppName | |
| host: sweetdomain.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment