From 057d243db80e0befe9656fcf7c8968f964a26680 Mon Sep 17 00:00:00 2001 From: cn Date: Fri, 22 Apr 2022 21:32:27 +0200 Subject: [PATCH] gem: make intention of ENV.fetch clear with explicit default value --- lib/openvpn-status-web.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/openvpn-status-web.rb b/lib/openvpn-status-web.rb index a02ec90..0bd7fcc 100755 --- a/lib/openvpn-status-web.rb +++ b/lib/openvpn-status-web.rb @@ -9,7 +9,7 @@ require 'yaml' require 'rack' 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' @@ -128,7 +128,7 @@ module OpenVPNStatusWeb # 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