|
@ -1,7 +1,6 @@ |
|
|
require 'dotenv' |
|
|
require 'dotenv' |
|
|
|
|
|
|
|
|
# FIXME: do not use global variable |
|
|
|
|
|
$definable_thread_group ||= ThreadGroup.new |
|
|
|
|
|
|
|
|
DEFINABLE_THREAD_GROUP ||= ThreadGroup.new # rubocop:disable Lint/OrAssignmentToConstant |
|
|
|
|
|
|
|
|
module Live |
|
|
module Live |
|
|
# offers typed constant defintions with default value, by using lots of introspecting... |
|
|
# offers typed constant defintions with default value, by using lots of introspecting... |
|
@ -85,13 +84,13 @@ module Live |
|
|
value = typed_value(type, raw_value, default) |
|
|
value = typed_value(type, raw_value, default) |
|
|
definitions[constant] = { type:, default:, value: } |
|
|
definitions[constant] = { type:, default:, value: } |
|
|
|
|
|
|
|
|
# puts("-- new definition #{constant}:#{definitions[constant]}") |
|
|
|
|
|
|
|
|
# logger.debug("new definition #{constant}:#{definitions[constant]}") |
|
|
value |
|
|
value |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def start_listener |
|
|
def start_listener |
|
|
$definable_thread_group.list.each(&:kill) |
|
|
|
|
|
$definable_thread_group.add(Thread.new do |
|
|
|
|
|
|
|
|
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 |
|
|
rescue StandardError |
|
|