Module: Sensu::Settings
- Defined in:
- lib/sensu/settings.rb,
lib/sensu/settings/rules.rb,
lib/sensu/settings/loader.rb,
lib/sensu/settings/constants.rb,
lib/sensu/settings/validator.rb,
lib/sensu/settings/validators.rb,
lib/sensu/settings/validators/api.rb,
lib/sensu/settings/validators/check.rb,
lib/sensu/settings/validators/sensu.rb,
lib/sensu/settings/validators/client.rb,
lib/sensu/settings/validators/filter.rb,
lib/sensu/settings/validators/handler.rb,
lib/sensu/settings/validators/mutator.rb,
lib/sensu/settings/validators/extension.rb,
lib/sensu/settings/validators/transport.rb,
lib/sensu/settings/validators/time_window.rb
Defined Under Namespace
Modules: Rules, Validators Classes: Loader, Validator
Constant Summary collapse
- CATEGORIES =
[:checks, :filters, :mutators, :handlers, :extensions]
Class Method Summary collapse
-
.get(options = {}) ⇒ Loader
Retrieve the current loaded settings loader or load one up if there isn’t one.
-
.load(options = {}) ⇒ Loader
Load Sensu settings.
Class Method Details
.get(options = {}) ⇒ Loader
Retrieve the current loaded settings loader or load one up if there isn’t one. Note: We may need to add a mutex for thread safety.
42 43 44 |
# File 'lib/sensu/settings.rb', line 42 def get(={}) @loader || load() end |
.load(options = {}) ⇒ Loader
Load Sensu settings.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sensu/settings.rb', line 13 def load(={}) @loader = Loader.new @loader.load_env if [:config_file] @loader.load_file([:config_file], false) end if [:config_dir] @loader.load_directory([:config_dir]) end if [:config_dirs] [:config_dirs].each do |directory| @loader.load_directory(directory) end end if @loader.validate.empty? @loader.set_env! end @loader.load_overrides! @loader rescue Loader::Error @loader end |