Class: Kaal::SchedulerBootLoader
- Inherits:
-
Object
- Object
- Kaal::SchedulerBootLoader
- Defined in:
- lib/kaal/runtime/scheduler_boot_loader.rb
Overview
Loads scheduler.yml at framework boot time while respecting missing-file policy.
Instance Method Summary collapse
-
#initialize(configuration_provider:, logger:, runtime_context:, load_scheduler_file:) ⇒ SchedulerBootLoader
constructor
A new instance of SchedulerBootLoader.
- #load_on_boot ⇒ Object
- #load_on_boot! ⇒ Object
Constructor Details
#initialize(configuration_provider:, logger:, runtime_context:, load_scheduler_file:) ⇒ SchedulerBootLoader
Returns a new instance of SchedulerBootLoader.
10 11 12 13 14 15 |
# File 'lib/kaal/runtime/scheduler_boot_loader.rb', line 10 def initialize(configuration_provider:, logger:, runtime_context:, load_scheduler_file:) @configuration_provider = configuration_provider @logger = logger @runtime_context = runtime_context @load_scheduler_file = load_scheduler_file end |
Instance Method Details
#load_on_boot ⇒ Object
17 18 19 |
# File 'lib/kaal/runtime/scheduler_boot_loader.rb', line 17 def load_on_boot load_on_boot! end |
#load_on_boot! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/kaal/runtime/scheduler_boot_loader.rb', line 21 def load_on_boot! configuration = fetch_configuration return unless configuration Kaal.warn_on_risky_configuration!(configuration:, logger: @logger) return load_scheduler_file if configuration.scheduler_missing_file_policy == :error scheduler_path = configuration.scheduler_config_path.to_s.strip return if scheduler_path.empty? absolute_path = @runtime_context.resolve_path(scheduler_path) unless File.exist?(absolute_path) @logger&.warn("Scheduler file not found at #{absolute_path}") return end load_scheduler_file end |