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