lib/openvpn-status-web.rb in openvpn-status-web-3.2.1 vs lib/openvpn-status-web.rb in openvpn-status-web-3.3.0

- old
+ new

@@ -5,13 +5,14 @@ require 'etc' require 'logger' require 'ipaddr' require 'yaml' require 'rack' +require 'rackup' require 'erb' require 'metriks' -require 'better_errors' if ENV['RACK_ENV'] == 'development' +require 'better_errors' if ENV.fetch('RACK_ENV', nil) == 'development' require 'openvpn-status-web/status' require 'openvpn-status-web/parser/v1' require 'openvpn-status-web/parser/v2' require 'openvpn-status-web/parser/v3' @@ -126,23 +127,23 @@ Process::Sys.setuid(user.uid) if user end # configure rack app = Daemon.new(config['vpns']) - if ENV['RACK_ENV'] == 'development' + if ENV.fetch('RACK_ENV', nil) == 'development' app = BetterErrors::Middleware.new(app) BetterErrors.application_root = File.expand_path(__dir__) end Signal.trap('INT') do OpenVPNStatusWeb.logger.info 'Quitting...' - Rack::Handler::WEBrick.shutdown + Rackup::Handler::WEBrick.shutdown end Signal.trap('TERM') do OpenVPNStatusWeb.logger.info 'Quitting...' - Rack::Handler::WEBrick.shutdown + Rackup::Handler::WEBrick.shutdown end - Rack::Handler::WEBrick.run app, Host: config['host'], Port: config['port'] + Rackup::Handler::WEBrick.run app, Host: config['host'], Port: config['port'] end end end