portertech-sensu-settings 10.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +28 -0
- data/lib/sensu/settings/constants.rb +5 -0
- data/lib/sensu/settings/loader.rb +502 -0
- data/lib/sensu/settings/rules.rb +166 -0
- data/lib/sensu/settings/validator.rb +88 -0
- data/lib/sensu/settings/validators/api.rb +65 -0
- data/lib/sensu/settings/validators/check.rb +253 -0
- data/lib/sensu/settings/validators/client.rb +238 -0
- data/lib/sensu/settings/validators/extension.rb +18 -0
- data/lib/sensu/settings/validators/filter.rb +27 -0
- data/lib/sensu/settings/validators/handler.rb +132 -0
- data/lib/sensu/settings/validators/mutator.rb +18 -0
- data/lib/sensu/settings/validators/sensu.rb +102 -0
- data/lib/sensu/settings/validators/tessen.rb +22 -0
- data/lib/sensu/settings/validators/time_window.rb +74 -0
- data/lib/sensu/settings/validators/transport.rb +22 -0
- data/lib/sensu/settings/validators.rb +29 -0
- data/lib/sensu/settings.rb +52 -0
- data/sensu-settings.gemspec +24 -0
- metadata +133 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
require "sensu/settings/validators/sensu"
|
2
|
+
require "sensu/settings/validators/tessen"
|
3
|
+
require "sensu/settings/validators/transport"
|
4
|
+
require "sensu/settings/validators/time_window"
|
5
|
+
require "sensu/settings/validators/check"
|
6
|
+
require "sensu/settings/validators/filter"
|
7
|
+
require "sensu/settings/validators/mutator"
|
8
|
+
require "sensu/settings/validators/handler"
|
9
|
+
require "sensu/settings/validators/client"
|
10
|
+
require "sensu/settings/validators/api"
|
11
|
+
require "sensu/settings/validators/extension"
|
12
|
+
|
13
|
+
module Sensu
|
14
|
+
module Settings
|
15
|
+
module Validators
|
16
|
+
include Sensu
|
17
|
+
include Tessen
|
18
|
+
include Transport
|
19
|
+
include TimeWindow
|
20
|
+
include Check
|
21
|
+
include Filter
|
22
|
+
include Mutator
|
23
|
+
include Handler
|
24
|
+
include Client
|
25
|
+
include API
|
26
|
+
include Extension
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "sensu/settings/loader"
|
2
|
+
|
3
|
+
module Sensu
|
4
|
+
module Settings
|
5
|
+
class << self
|
6
|
+
attr_accessor :loader
|
7
|
+
|
8
|
+
# Load Sensu settings.
|
9
|
+
#
|
10
|
+
# Settings are loaded in following order, prior to validation:
|
11
|
+
# 1. Environment Variables
|
12
|
+
# 2. JSON files on disk
|
13
|
+
# 3. Automaticly detected overrides (e.g. hostname, IP address)
|
14
|
+
#
|
15
|
+
# @param [Hash] options
|
16
|
+
# @option options [String] :config_file to load.
|
17
|
+
# @option options [String] :config_dir to load.
|
18
|
+
# @option options [Array] :config_dirs to load.
|
19
|
+
# @return [Loader] a loaded instance of Loader.
|
20
|
+
def load(options={})
|
21
|
+
loader = Loader.new
|
22
|
+
loader.load_env
|
23
|
+
if options[:config_file]
|
24
|
+
loader.load_file(options[:config_file], false)
|
25
|
+
end
|
26
|
+
if options[:config_dir]
|
27
|
+
loader.load_directory(options[:config_dir])
|
28
|
+
end
|
29
|
+
if options[:config_dirs]
|
30
|
+
options[:config_dirs].each do |directory|
|
31
|
+
loader.load_directory(directory)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
loader.load_overrides!
|
35
|
+
loader.validate
|
36
|
+
loader
|
37
|
+
rescue Loader::Error
|
38
|
+
loader
|
39
|
+
end
|
40
|
+
|
41
|
+
# Retrieve the current loaded settings loader or load one up if
|
42
|
+
# there isn't one. Note: We may need to add a mutex for thread
|
43
|
+
# safety.
|
44
|
+
#
|
45
|
+
# @param [Hash] options to pass to load().
|
46
|
+
# @return [Loader] instance of a loaded loader.
|
47
|
+
def get(options={})
|
48
|
+
@loader || @loader = load(options)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "portertech-sensu-settings"
|
5
|
+
spec.version = "10.18.0"
|
6
|
+
spec.authors = ["Sean Porter"]
|
7
|
+
spec.email = ["portertech@gmail.com"]
|
8
|
+
spec.summary = "The Sensu settings library, loader and validator"
|
9
|
+
spec.description = "The Sensu settings library, loader and validator"
|
10
|
+
spec.homepage = "https://github.com/sensu/sensu-settings"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = Dir.glob("lib/**/*") + %w[sensu-settings.gemspec README.md LICENSE.txt]
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "portertech-sensu-json", ">= 2.2.1"
|
19
|
+
spec.add_dependency "parse-cron"
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.4"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: portertech-sensu-settings
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 10.18.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Porter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: portertech-sensu-json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: parse-cron
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: The Sensu settings library, loader and validator
|
84
|
+
email:
|
85
|
+
- portertech@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
- lib/sensu/settings.rb
|
93
|
+
- lib/sensu/settings/constants.rb
|
94
|
+
- lib/sensu/settings/loader.rb
|
95
|
+
- lib/sensu/settings/rules.rb
|
96
|
+
- lib/sensu/settings/validator.rb
|
97
|
+
- lib/sensu/settings/validators.rb
|
98
|
+
- lib/sensu/settings/validators/api.rb
|
99
|
+
- lib/sensu/settings/validators/check.rb
|
100
|
+
- lib/sensu/settings/validators/client.rb
|
101
|
+
- lib/sensu/settings/validators/extension.rb
|
102
|
+
- lib/sensu/settings/validators/filter.rb
|
103
|
+
- lib/sensu/settings/validators/handler.rb
|
104
|
+
- lib/sensu/settings/validators/mutator.rb
|
105
|
+
- lib/sensu/settings/validators/sensu.rb
|
106
|
+
- lib/sensu/settings/validators/tessen.rb
|
107
|
+
- lib/sensu/settings/validators/time_window.rb
|
108
|
+
- lib/sensu/settings/validators/transport.rb
|
109
|
+
- sensu-settings.gemspec
|
110
|
+
homepage: https://github.com/sensu/sensu-settings
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubygems_version: 3.4.10
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: The Sensu settings library, loader and validator
|
133
|
+
test_files: []
|