Last active
December 31, 2015 17:39
-
-
Save sawanoboly/8021710 to your computer and use it in GitHub Desktop.
Settingslogicを使ってconfig.yml, config.local.yml運用してみる ref: http://qiita.com/sawanoboly/items/1d776006ed24513e1b55
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 'settingslogic' | |
class EnvSettings < Settingslogic | |
source File.expand_path('../config.yml', __FILE__) | |
end | |
if File.exist?(File.expand_path('../config.local.yml', __FILE__)) | |
class EnvLocalSettings < Settingslogic | |
source File.expand_path('../config.local.yml', __FILE__) | |
end | |
EnvSettings.merge!(EnvLocalSettings) | |
end | |
puts EnvSettings[:hoge] |
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
hoge: mogemoge |
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
hoge: <%= ENV['HOGEHOGE'] %> |
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
$ HOGEHOGE=moge ruby ./app.rb | |
moge |
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
$ HOGEHOGE=moge ruby ./app.rb | |
mogemoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment