2012-02-09 403 views

回答

1

,你可以有這樣的事情:

configure :development do 
    set :this 
end 

configure :production do 
    set :that 
end 
0

如果設置幾個:

對c lassic西納特拉應用:

port = 4567 if development? 
port = 80 if production? 

對於模塊化西納特拉應用:

port = 4567 if Sinatra::Base.environment == :development 
port = 80 if Sinatra::Base.environment == :production 

但是,如果你有幾個環境相關的設置,使用以上三種的建議是清潔:

configure :development, :test do 
    port = 4567 
    url = "https://secure.appname.com" 
    ... 
end