Class: PimonConfig
- Inherits:
-
Object
- Object
- PimonConfig
- Defined in:
- lib/pimon/pimon_config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #basic_auth ⇒ Object
- #chart ⇒ Object
- #is_basic_auth_enabled? ⇒ Boolean
- #queues ⇒ Object
- #redis ⇒ Object
- #stats ⇒ Object
- #valid? ⇒ Boolean
Class Method Details
.create_new(filename) ⇒ Object
5 6 7 8 9 |
# File 'lib/pimon/pimon_config.rb', line 5 def self.create_new(filename) config = self.new(filename) return config if config.valid? end |
Instance Method Details
#basic_auth ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/pimon/pimon_config.rb', line 11 def basic_auth if is_basic_auth_enabled? && has_authentication_details? [@config[:basic_auth][:username], @config[:basic_auth][:password]] else nil end end |
#chart ⇒ Object
19 20 21 |
# File 'lib/pimon/pimon_config.rb', line 19 def chart @config[:chart] end |
#is_basic_auth_enabled? ⇒ Boolean
23 24 25 |
# File 'lib/pimon/pimon_config.rb', line 23 def is_basic_auth_enabled? @config[:basic_auth][:enabled] end |
#queues ⇒ Object
27 28 29 |
# File 'lib/pimon/pimon_config.rb', line 27 def queues @config[:queues] end |
#redis ⇒ Object
31 32 33 |
# File 'lib/pimon/pimon_config.rb', line 31 def redis @config[:redis] end |
#stats ⇒ Object
35 36 37 |
# File 'lib/pimon/pimon_config.rb', line 35 def stats @config[:stats_collector] end |
#valid? ⇒ Boolean
39 40 41 42 43 |
# File 'lib/pimon/pimon_config.rb', line 39 def valid? raise "Basic auth enabled with no authentication details" if is_basic_auth_enabled? && !has_authentication_details? raise "Redis has no socket details" unless has_redis_details? true end |