From 61646780607e3e43a581053038bb169efedd3e3d Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 25 Aug 2009 20:46:36 +0200 Subject: refactured for redis key-value database, passes initial tests --- config.ru | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'config.ru') diff --git a/config.ru b/config.ru index 85e510e..961b2d8 100644 --- a/config.ru +++ b/config.ru @@ -1,12 +1,23 @@ require 'rubygems' require 'sinatra' require 'application.rb' +require 'rack' +require 'rack/contrib' -if ENV["RACK_ENV"] == 'production' - FileUtils.mkdir_p 'log' unless File.exists?('log') - log = File.new("log/sinatra.log", "a") - $stdout.reopen(log) - $stderr.reopen(log) -end +FileUtils.mkdir_p 'log' unless File.exists?('log') +log = File.new("log/#{ENV["RACK_ENV"]}.log", "a") +$stdout.reopen(log) +$stderr.reopen(log) +if ENV['RACK_ENV'] == 'production' + use Rack::MailExceptions do |mail| + mail.to 'helma@in-silico.ch' + mail.subject '[ERROR] %s' + end +else + use Rack::Reloader + use Rack::ShowExceptions +end + run Sinatra::Application + -- cgit v1.2.3