initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user