class MicroboshHacker::HealthMonitorConfig
Constants
- AVAILABLE_OPTS
- OPTIONAL_OPTS
- REQUIRED_OPTS
Attributes
config_path[R]
opts[R]
Public Class Methods
new(config_path, opts = {})
click to toggle source
# File lib/microbosh_hacker/health_monitor_config.rb, line 10 def initialize(config_path, opts = {}) @config_path=config_path @opts=opts raise "Missing options: #{(REQUIRED_OPTS - @opts.keys).join(', ')}" unless (REQUIRED_OPTS - @opts.keys).empty? opts.each_pair do |k, v| raise "Nil or empty option: #{k}" if v.nil? || v.to_s.empty? end end
Public Instance Methods
to_yaml()
click to toggle source
# File lib/microbosh_hacker/health_monitor_config.rb, line 20 def to_yaml config = ::YAML.load_file(config_path) config['plugins'].unshift( { 'name' => 'email', 'events' => [ 'alert' ], 'options' => { 'recipients' => opts[:email_recipients], 'smtp' => { 'from' => opts[:from], 'host' => opts[:host], 'port' => opts[:port], 'domain' => opts[:domain] } } } ) # auth: 'plain # user: user # password: pass123 # interval:1 config.to_yaml end