Created
April 15, 2013 15:33
-
-
Save yb66/5388992 to your computer and use it in GitHub Desktop.
Shared *and* individual configuration in Sinatra.
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
require 'sinatra' | |
configure :development do | |
set :one, 1 | |
end | |
configure :production do | |
set :one, 11 | |
end | |
configure :production, :development do | |
set :three, 3 | |
end | |
get "/" do | |
haml <<STR | |
%p= "settings.one: #{settings.one.inspect}" | |
%p= "settings.three: #{settings.three.inspect}" | |
STR | |
end | |
# run `bundle install --binstubs --path vendor` | |
# and then | |
# `env RACK_ENV=development bundle exec ruby app.rb` and | |
# `env RACK_ENV=production bundle exec ruby app.rb` | |
# to see that you get different `one`s but the same `three`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment