1
0
mirror of https://github.com/cmur2/openvpn-status-web.git synced 2024-12-22 12:54:24 +01:00

Use better_errors

This commit is contained in:
cn 2013-05-03 19:49:09 +02:00
parent 635e562a3d
commit ed42fc9f30
2 changed files with 12 additions and 4 deletions

View File

@ -7,6 +7,7 @@ require 'yaml'
require 'rack' require 'rack'
require 'erb' require 'erb'
require 'metriks' require 'metriks'
require 'better_errors'
require 'openvpn-status-web/status' require 'openvpn-status-web/status'
require 'openvpn-status-web/parser/v1' require 'openvpn-status-web/parser/v1'
@ -40,11 +41,11 @@ module OpenVPNStatusWeb
return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if env["PATH_INFO"] != "/" return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if env["PATH_INFO"] != "/"
# variables for template # variables for template
#name = @vpns.keys.first name = @vpns.keys.first
#status = read_status_log(@vpns[name]['status_file']) status = read_status_log(@vpns[name]['status_file'])
# eval # eval
#html = @main_tmpl.result(binding) html = @main_tmpl.result(binding)
html = "" #html = ""
[200, {"Content-Type" => "text/html"}, [html]] [200, {"Content-Type" => "text/html"}, [html]]
end end
@ -90,7 +91,12 @@ module OpenVPNStatusWeb
OpenVPNStatusWeb.logger.info "Starting..." OpenVPNStatusWeb.logger.info "Starting..."
# configure rack
app = Daemon.new(config['vpns']) app = Daemon.new(config['vpns'])
if ENV['RACK_ENV'] == "development"
app = BetterErrors::Middleware.new(app)
BetterErrors.application_root = File.expand_path("..", __FILE__)
end
Signal.trap('INT') do Signal.trap('INT') do
OpenVPNStatusWeb.logger.info "Quitting..." OpenVPNStatusWeb.logger.info "Quitting..."

View File

@ -27,4 +27,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake' s.add_development_dependency 'rake'
s.add_development_dependency 'rspec' s.add_development_dependency 'rspec'
s.add_development_dependency 'rack-test' s.add_development_dependency 'rack-test'
s.add_development_dependency 'better_errors'
s.add_development_dependency 'binding_of_caller'
end end