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/tessen.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 Attribute Summary collapse
-
.loader ⇒ Object
Returns the value of attribute loader.
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 Attribute Details
.loader ⇒ Object
Returns the value of attribute loader.
6 7 8 |
# File 'lib/sensu/settings.rb', line 6 def loader @loader end |
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.
47 48 49 |
# File 'lib/sensu/settings.rb', line 47 def get(={}) @loader || @loader = load() end |
.load(options = {}) ⇒ Loader
Load Sensu settings.
Settings are loaded in following order, prior to validation:
-
Environment Variables
-
JSON files on disk
-
Automaticly detected overrides (e.g. hostname, IP address)
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sensu/settings.rb', line 20 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 loader.load_overrides! loader.validate loader rescue Loader::Error loader end |