Reputation: 22114
like the remote server and port number, It's really annoying to change back and forth, I noticed there's a
set :environment, :production/:development
configuration option for sinatra, but I don't know how to set different variable to each mode
Upvotes: 0
Views: 171
Reputation: 143
If your settings are few:
For classic Sinatra apps:
port = 4567 if development?
port = 80 if production?
For modular Sinatra apps:
port = 4567 if Sinatra::Base.environment == :development
port = 80 if Sinatra::Base.environment == :production
But if you have several environment dependent settings, using three's suggestion above is cleaner:
configure :development, :test do
port = 4567
url = "https://secure.appname.com"
...
end
Upvotes: 0
Reputation: 8488
you can have something like this:
configure :development do
set :this
end
configure :production do
set :that
end
Upvotes: 1