From: David Lutterkort lutter@redhat.com
* do not hardcode production mode by default * set configuration at the top of server.rb * in dev mode, make stdout and stderr synchronous --- server/libexec/config.ru | 8 -------- server/libexec/server.rb | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/server/libexec/config.ru b/server/libexec/config.ru index 5ca4fbb..6d37a5f 100644 --- a/server/libexec/config.ru +++ b/server/libexec/config.ru @@ -1,13 +1,5 @@ require 'sinatra' require 'rubygems'
-set :environment => :production -set :raise_errors => false -set :run => false - -#log = File.new("log/deltacloud.log", "a+") -#STDOUT.reopen(log) -#STDERR.reopen(log) - require 'server.rb' run Sinatra::Application diff --git a/server/libexec/server.rb b/server/libexec/server.rb index 8185eff..2ebe277 100644 --- a/server/libexec/server.rb +++ b/server/libexec/server.rb @@ -12,6 +12,14 @@ require 'sinatra/rabbit' require 'sinatra/validation' require 'sinatra/lazy_auth'
+set :raise_errors => false + +configure :development do + # So we can just use puts for logging + $stdout.sync = true + $stderr.sync = true +end + DRIVER=ENV['API_DRIVER'] ? ENV['API_DRIVER'].to_sym : :mock
# You could use $API_HOST environment variable to change your hostname to