Class: ContainerConfig::Coercer::SslCertificate
- Defined in:
- lib/container_config/coercer/ssl_certificate.rb
Overview
SSL certificate type coercer
Instance Method Summary collapse
-
#coerce(value) ⇒ OpenSSL::X509::Certificate
Coerces the given value into an SSL certificate.
- #name ⇒ Object
- #type ⇒ Object
Instance Method Details
#coerce(value) ⇒ OpenSSL::X509::Certificate
Coerces the given value into an SSL certificate
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/container_config/coercer/ssl_certificate.rb', line 28 def coerce(value) return if value.nil? return value if value.is_a?(OpenSSL::X509::Certificate) cert_path = value.to_s unless File.exist?(cert_path) ContainerConfig.logger.warn { "Could not find SSL certificate at #{cert_path}" } return nil end OpenSSL::X509::Certificate.new(File.read(cert_path)) rescue OpenSSL::X509::CertificateError => e ContainerConfig.logger.warn { "Could not parse SSL certificate #{cert_path} successfully: #{e}" } nil end |
#name ⇒ Object
12 13 14 |
# File 'lib/container_config/coercer/ssl_certificate.rb', line 12 def name "SSL Certificate" end |
#type ⇒ Object
17 18 19 |
# File 'lib/container_config/coercer/ssl_certificate.rb', line 17 def type :ssl_certificate end |