Sha256: 83ea1a77fe1da4a44422f69ecdd38d917305cee888bacf1f07b61d13423846d1

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

require 'asetus'

module Ring
  class SQA
    Directory = '/etc/ring-sqa'
    class InvalidConfig < StandardError; end
    class NoConfig < StandardError; end

    Config = Asetus.new name: 'sqa', load: false, usrdir: Directory, cfgfile: 'main.conf'
    hosts  = Asetus.new name: 'sqa', load: false, usrdir: Directory, cfgfile: 'hosts.conf'

    Config.default.directory          = Directory
    Config.default.debug              = false
    Config.default.port               = 'ring'.to_i(36)/100
    Config.default.analyzer.tolerance = 1.2
    Config.default.analyzer.size      = 30
    Config.default.analyzer.median_of = 27
    Config.default.nodes_json         = '/etc/ring/nodes.json'
    Config.default.mtr.args           = '-i0.5 -c5 -r -w -n'
    Config.default.mtr.timeout        = 15
    Config.default.ram_database       = false
    Config.default.paste.url          = 'https://ring.nlnog.net/paste/'

    hosts.default.load                = %w( ring.nlnog.net )
    hosts.default.ignore              = %w( infra.ring.nlnog.net )

    begin
      Config.load
      hosts.load
    rescue => error
      raise InvalidConfig, "Error loading configuration: #{error.message}"
    end

    CFG = Config.cfg
    CFG.hosts = hosts.cfg

    CFG.host.name = Socket.gethostname
    CFG.host.ipv4 = Socket::getaddrinfo(CFG.host.name,"echo",Socket::AF_INET)[0][3]
    CFG.host.ipv6 = Socket::getaddrinfo(CFG.host.name,"echo",Socket::AF_INET6)[0][3]

    hosts.create
    raise NoConfig, 'edit /etc/ring-sqa/main.conf' if Config.create
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ring-sqa-0.2.1 lib/ring/sqa/cfg.rb
ring-sqa-0.2.0 lib/ring/sqa/cfg.rb
ring-sqa-0.1.12 lib/ring/sqa/cfg.rb
ring-sqa-0.1.11 lib/ring/sqa/cfg.rb
ring-sqa-0.1.10 lib/ring/sqa/cfg.rb
ring-sqa-0.1.9 lib/ring/sqa/cfg.rb
ring-sqa-0.1.8 lib/ring/sqa/cfg.rb
ring-sqa-0.1.7 lib/ring/sqa/cfg.rb
ring-sqa-0.1.6 lib/ring/sqa/cfg.rb
ring-sqa-0.1.5 lib/ring/sqa/cfg.rb
ring-sqa-0.1.4 lib/ring/sqa/cfg.rb
ring-sqa-0.1.3 lib/ring/sqa/cfg.rb
ring-sqa-0.1.2 lib/ring/sqa/cfg.rb
ring-sqa-0.1.1 lib/ring/sqa/cfg.rb
ring-sqa-0.1.0 lib/ring/sqa/cfg.rb