Browse Source

hotenv

main
pvincent 5 months ago
parent
commit
f854812fbc
  1. 9
      lib/hot_constants/live_constants.rb

9
lib/hot_constants/live_constants.rb

@ -1,18 +1,19 @@
require 'dotenv'
# Development Constants
# Hot Live Constants
module LiveConstants
HOT = {} # rubocop:disable Style/MutableConstant
HOTENV = {} # rubocop:disable Style/MutableConstant
LOGGER = SemanticLogger[to_s]
class << self
def stimulus_debug = load_boolean('STIMULUS_DEBUG', false)
def log_active_record = load_boolean('LOG_ACTIVE_RECORD', true)
def log_action_view = load_boolean('LOG_ACTION_VIEW', true)
def load_boolean(key, default) = HOT.fetch(key, default).to_s.downcase == 'true'
def load_boolean(key, default) = HOTENV.fetch(key, default).to_s.downcase == 'true'
def reload!
HOT.replace Dotenv.parse
HOTENV.replace Dotenv.parse
# LOGGER.warn 'reloaded!'
ActiveRecord::Base.logger.level = log_active_record ? :debug : :fatal

Loading…
Cancel
Save