2012-12-24 58 views

回答

4

你可以創建自己的病情檢查環境:

set(:check_env) {|value| condition{value == settings.environment}} 

get '/logs', :check_env => :development do 
    #dump logs 
end 

另一個,可能更簡單,選擇是隻在創建發展的路徑:

configure :development do 
    get '/logs' do 
    #dump logs 
    end 
end 
+0

不錯!謝謝 :) –

1
get '/logs' if ENV['RACK_ENV'] == 'development' 

應該工作

+2

另外,'settings.environment'默認爲'ENV ['RACK_ENV']。to_sym' so你可以檢查'settings.environment ==:開發' –

相關問題