You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
708 B

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. require 'dotenv'
  2. # Hot Live Constants
  3. module LiveConstants
  4. HOTENV = {} # rubocop:disable Style/MutableConstant
  5. LOGGER = SemanticLogger[to_s]
  6. class << self
  7. def stimulus_debug = load_boolean('STIMULUS_DEBUG', false)
  8. def log_active_record = load_boolean('LOG_ACTIVE_RECORD', true)
  9. def log_action_view = load_boolean('LOG_ACTION_VIEW', true)
  10. def load_boolean(key, default) = HOTENV.fetch(key, default).to_s.downcase == 'true'
  11. def reload!
  12. HOTENV.replace Dotenv.parse
  13. # LOGGER.warn 'reloaded!'
  14. ActiveRecord::Base.logger.level = log_active_record ? :debug : :fatal
  15. ActionView::Base.logger.level = log_action_view ? :debug : :fatal
  16. end
  17. end
  18. reload!
  19. end