bin/netchk in netchk-0.0.1.beta vs bin/netchk in netchk-0.0.1

- old
+ new

@@ -2,11 +2,22 @@ require "netchk" require 'netchk/ip_verifier' require 'netchk/dns_server_verifier' require 'netchk/dns_resolv_verifier' -require 'netchk/tcp_ping_verifier' +require 'netchk/icmp_ping_verifier' +require 'yaml' +config_files = %w[.netchk.yaml .netchk.yml].map { |f| File.join(Dir.home, f) } + +config_file = config_files.find(&File.method(:exists?)) + +config = config_file + &.then(&File.method(:read)) + &.then(&YAML.method(:load)) + +config = config || {} + Netchk::IpVerifier.new.verify -Netchk::DNSServerVerifier.new.verify -Netchk::DNSResolvVerifier.new.verify -Netchk::TcpPingVerifier.new.verify +Netchk::DNSServerVerifier.new(**(config['dns'] || {})).verify +Netchk::DNSResolvVerifier.new(**(config['resolv'] || {})).verify +Netchk::ICMPPingVerifier.new(**(config['icmp'] || {})).verify