Class: Remon::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/remon/config.rb

Constant Summary collapse

LOAD_PATHS =
["#{__dir__}/checks"]

Instance Method Summary collapse

Constructor Details

#initialize(config_file: nil, config_dir: nil, load_paths: []) ⇒ Config

Returns a new instance of Config.



15
16
17
18
19
20
21
22
23
24
# File 'lib/remon/config.rb', line 15

def initialize(config_file: nil, config_dir: nil, load_paths: [])
  @config_file = config_file
  @config_dir = config_dir
  @schedule = {}
  @scheduler_offset = 0
  @workers = 1
  @task_group = { interval: 0, offset: 15, randomize: false }
  load_paths = Set.new(load_paths).merge(LOAD_PATHS)
  @dsl = CheckDsl.new load_paths.to_a
end

Instance Method Details

#configObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/remon/config.rb', line 26

def config
  @config_read ||= begin
    read_config
    true
  end
  {
    schedule: @schedule,
    scheduler_offset: @scheduler_offset,
    process_proc: @process_proc,
    workers: @workers
  }
end