diff --git a/lib/openvpn-status-web.rb b/lib/openvpn-status-web.rb index 006c4e2..cfb9b1b 100644 --- a/lib/openvpn-status-web.rb +++ b/lib/openvpn-status-web.rb @@ -7,6 +7,7 @@ require 'yaml' require 'rack' require 'erb' require 'metriks' +require 'better_errors' require 'openvpn-status-web/status' require 'openvpn-status-web/parser/v1' @@ -40,11 +41,11 @@ module OpenVPNStatusWeb return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if env["PATH_INFO"] != "/" # variables for template - #name = @vpns.keys.first - #status = read_status_log(@vpns[name]['status_file']) + name = @vpns.keys.first + status = read_status_log(@vpns[name]['status_file']) # eval - #html = @main_tmpl.result(binding) - html = "" + html = @main_tmpl.result(binding) + #html = "" [200, {"Content-Type" => "text/html"}, [html]] end @@ -90,7 +91,12 @@ module OpenVPNStatusWeb OpenVPNStatusWeb.logger.info "Starting..." + # configure rack 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 OpenVPNStatusWeb.logger.info "Quitting..." diff --git a/openvpn-status-web.gemspec b/openvpn-status-web.gemspec index a7de756..214c48f 100644 --- a/openvpn-status-web.gemspec +++ b/openvpn-status-web.gemspec @@ -27,4 +27,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake' s.add_development_dependency 'rspec' s.add_development_dependency 'rack-test' + s.add_development_dependency 'better_errors' + s.add_development_dependency 'binding_of_caller' end