25 lines
439 B
Ruby
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
|