From 95054d6a7d01156f719a188a02166ea0d084067e Mon Sep 17 00:00:00 2001 From: Christopher Vollick <0@psycoti.ca> Date: Tue, 27 May 2025 12:06:00 -0400 Subject: [PATCH] Replace ENV[] with ENV.fetch 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. --- bin/correct_duplicate_addrs | 2 +- config.ru | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/correct_duplicate_addrs b/bin/correct_duplicate_addrs index e71a4789daa140388fc0ded4f0f8fe9519a2ea86..b993c926666b4519e41437b7a172fa0263c9574a 100755 --- a/bin/correct_duplicate_addrs +++ b/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 " \ diff --git a/config.ru b/config.ru index 6c96ddafb46aa4af10ffc09f15a7c0b43a320b8a..616528e769363170b8911a1e58c5555dce22f698 100644 --- a/config.ru +++ b/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