Module: DNSResolver::Config
Constant Summary collapse
- DEFAULTS =
{ :nameservers => %w(8.8.8.8 8.8.4.4), :registry_name => 'dnsresolver' }
- DNSRUBY_DEFAULTS =
{ :query_timeout => 2, :do_caching => true, :dnssec => true, :recurse => true, :port => 53, :use_tcp => false, :tsig => nil, :ignore_truncation => false, :src_address => nil, :src_port => 0, :udp_size => 4096, :retry_times => 1, :retry_delay => 5, :packet_timeout => 5 }
Instance Method Summary collapse
- #dnsruby_settings ⇒ Object
- #load!(path) ⇒ Object
- #load_configuration(settings) ⇒ Object
- #settings ⇒ Object
Instance Method Details
#dnsruby_settings ⇒ Object
43 44 45 |
# File 'lib/dnsresolver/config.rb', line 43 def dnsruby_settings @settings && @settings[:dnsruby] ? DNSRUBY_DEFAULTS.merge(@settings[:dnsruby]) : DNSRUBY_DEFAULTS end |
#load!(path) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dnsresolver/config.rb', line 27 def load!(path) if path.kind_of?(IO) file = path else file = File.open path end settings = YAML.load(file) load_configuration(settings) if settings.present? settings end |
#load_configuration(settings) ⇒ Object
39 40 41 |
# File 'lib/dnsresolver/config.rb', line 39 def load_configuration(settings) @settings = settings.with_indifferent_access end |