class Kontena::Cli::Config::Server
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/kontena/cli/config.rb, line 573 def initialize(*args) super @table[:account] ||= 'master' end
Public Instance Methods
ssl_cert()
click to toggle source
@return [OpenSSL::X509::Certificate, nil]
# File lib/kontena/cli/config.rb, line 594 def ssl_cert if path = self.ssl_cert_path return OpenSSL::X509::Certificate.new(File.read(path)) else return nil end end
ssl_cert_path()
click to toggle source
@return [String, nil] path to ~/.kontena/certs/*.pem
# File lib/kontena/cli/config.rb, line 583 def ssl_cert_path path = File.join(Dir.home, '.kontena', 'certs', "#{self.uri.host}.pem") if File.exist?(path) && File.readable?(path) return path else return nil end end
ssl_subject_cn()
click to toggle source
@return [String, nil] ssl cert subject CN=
# File lib/kontena/cli/config.rb, line 603 def ssl_subject_cn if cert = self.ssl_cert return cert.subject.to_a.select{|name, data, type| name == 'CN' }.map{|name, data, type| data }.first else nil end end
uri()
click to toggle source
# File lib/kontena/cli/config.rb, line 578 def uri @uri ||= URI.parse(self.url) end