|
|
@ -1,6 +1,6 @@ |
|
|
|
require 'dotenv' |
|
|
|
|
|
|
|
DEFINABLE_THREAD_GROUP ||= ThreadGroup.new # rubocop:disable Lint/OrAssignmentToConstant |
|
|
|
# DEFINABLE_THREAD_GROUP ||= ThreadGroup.new |
|
|
|
DEFINABLE_LISTENERS ||= [] # rubocop:disable Lint/OrAssignmentToConstant |
|
|
|
|
|
|
|
module Live |
|
|
@ -97,19 +97,15 @@ module Live |
|
|
|
end |
|
|
|
|
|
|
|
def start_listener |
|
|
|
DEFINABLE_LISTENERS.each(&:stop) # FIXME: issue on stop after multiple reload!!! Learn mode about listener: #close |
|
|
|
DEFINABLE_LISTENERS.each(&:stop) |
|
|
|
DEFINABLE_LISTENERS.clear |
|
|
|
DEFINABLE_THREAD_GROUP.list.each(&:kill) |
|
|
|
|
|
|
|
DEFINABLE_THREAD_GROUP.add(Thread.new do |
|
|
|
listener = Listen.to(Rails.root, only: /^\.env\.?/) do |
|
|
|
@@class_origin.reload_from_env |
|
|
|
rescue StandardError |
|
|
|
nil |
|
|
|
rescue StandardError => e |
|
|
|
logger.error('unable to reload from env', e) |
|
|
|
end |
|
|
|
DEFINABLE_LISTENERS << listener |
|
|
|
listener.start |
|
|
|
end) |
|
|
|
DEFINABLE_LISTENERS << listener |
|
|
|
end |
|
|
|
|
|
|
|
def typed_value(type, raw, default) |
|
|
|