Sha256: 055db0f4d2d18121b9b63ec296a2035af0a49dbe3eb82b99b235b4da9d1175e4
Contents?: true
Size: 1011 Bytes
Versions: 1
Compression:
Stored size: 1011 Bytes
Contents
# frozen_string_literal: true require "base64" require "json" require "logger" class CoreDns::Etcd attr_reader :api_url, :prefix, :postfix def initialize(url = nil) @logger = Logger.new($stdout) initialize_params @api_url = "http://#{url}:#{@port}/#{@version}" @endpoint = url end def domain(hostname) unless hostname.empty? && hostname.match?(/\A(?:(?!-)(?!.*--)[a-zA-Z0-9_][a-zA-Z0-9-_]{1,62}\.)+[a-zA-Z]{2,}\z/) raise RuntimeError.new "Invalid hostname" end CoreDns::Etcd::Domain.new(self, hostname) end def zone(domain) unless domain.empty? raise RuntimeError.new "Invalid domain" unless domain.match? /\A(?:(?!-)(?!.*--)[a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,}\z/ end CoreDns::Etcd::DnsZone.new(self, domain) end private def initialize_params @prefix = ENV["COREDNS_PREFIX"] || "skydns" @postfix = ENV["COREDNS_POSTFIX"] || "x" @port = ENV["COREDNS_PORT"] || 2379 @version = ENV["COREDNS_VERSION"] || "v3" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coredns-1.2.0 | lib/etcd.rb |