Skip to content

Instantly share code, notes, and snippets.

@sawanoboly
Last active December 31, 2015 17:39
Show Gist options
  • Save sawanoboly/8021710 to your computer and use it in GitHub Desktop.
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
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]
hoge: <%= ENV['HOGEHOGE'] %>
$ HOGEHOGE=moge ruby ./app.rb
moge
$ HOGEHOGE=moge ruby ./app.rb
mogemoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment