Files
fullodds.club/lib/full_odds/environment.rb
T
2026-10-25 23:19:29 -06:00

25 lines
439 B
Ruby

# frozen_string_literal: true
module FO::Environment
def self.fetch(k)
ENV.fetch(k)
end
def self.is_prod?
env == 'prod' ||
env == 'production'
end
def self.session_secret
s = ENV['SECRET']
if self.is_prod? && s.nil?
raise ArgumentError, "Environment variable SECRET missing in production environment"
end
s || ('x' * 64)
end
def self.env
ENV.fetch('ENVIRONMENT', 'prod')
end
end