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