Replace ENV[] with ENV.fetch

Christopher Vollick created

Just doing what rubocop tells me.

For one, since I'm there, I used `then` to not fetch twice.
I could have translated more directly, but I figured I'd do this while
I'm here.

Change summary

bin/correct_duplicate_addrs | 2 +-
config.ru                   | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

Detailed changes

bin/correct_duplicate_addrs 🔗

@@ -10,7 +10,7 @@ require "redis"
 
 redis = Redis.new
 
-customer_id = ENV["DEFAULT_CUSTOMER_ID"]
+customer_id = ENV.fetch("DEFAULT_CUSTOMER_ID", nil)
 unless customer_id
 	puts "The env-var DEFAULT_CUSTOMER_ID must be set to the ID " \
 	     "of the customer who will receive the duplicated addrs, preferably " \

config.ru 🔗

@@ -225,7 +225,7 @@ class CardVault
 end
 
 class JmpPay < Roda
-	SENTRY_DSN = ENV["SENTRY_DSN"] && URI(ENV["SENTRY_DSN"])
+	SENTRY_DSN = ENV.fetch("SENTRY_DSN", nil)&.then { |v| URI(v) }
 	plugin :render, engine: "slim"
 	plugin :cookies, path: "/"
 	plugin :common_logger, $stdout