class Acmesmith::Config
Constants
- ChallengeResponderRule
Public Class Methods
load_yaml(path)
click to toggle source
# File lib/acmesmith/config.rb, line 11 def self.load_yaml(path) new YAML.load_file(path) end
new(config)
click to toggle source
# File lib/acmesmith/config.rb, line 15 def initialize(config) @config = config validate end
Public Instance Methods
[](key)
click to toggle source
# File lib/acmesmith/config.rb, line 34 def [](key) @config[key] end
account_key_passphrase()
click to toggle source
# File lib/acmesmith/config.rb, line 58 def account_key_passphrase @config['account_key_passphrase'] end
bad_nonce_retry()
click to toggle source
# File lib/acmesmith/config.rb, line 54 def bad_nonce_retry @config['bad_nonce_retry'] || 0 end
certificate_key_passphrase()
click to toggle source
# File lib/acmesmith/config.rb, line 62 def certificate_key_passphrase @config['certificate_key_passphrase'] end
challenge_responders()
click to toggle source
# File lib/acmesmith/config.rb, line 90 def challenge_responders @challenge_responders ||= begin specs = @config['challenge_responders'].kind_of?(Hash) ? @config['challenge_responders'].map { |k,v| [k => v] } : @config['challenge_responders'] specs.flat_map do |specs_sub| specs_sub = specs_sub.dup filter = (specs_sub.delete('filter') || {}).map { |k,v| [k.to_sym, v] }.to_h specs_sub.map do |k,v| responder = ChallengeResponders.find(k).new(**v.map{ |k_,v_| [k_.to_sym, v_]}.to_h) ChallengeResponderRule.new( challenge_responder: responder, filter: ChallengeResponderFilter.new(responder, **filter), ) end end end end
connection_options()
click to toggle source
# File lib/acmesmith/config.rb, line 50 def connection_options @config['connection_options'] || {} end
directory()
click to toggle source
# File lib/acmesmith/config.rb, line 46 def directory @config.fetch('directory') end
fetch(*args)
click to toggle source
# File lib/acmesmith/config.rb, line 38 def fetch(*args) @config.fetch(*args) end
merge!(pair)
click to toggle source
# File lib/acmesmith/config.rb, line 42 def merge!(pair) @config.merge!(pair) end
post_issuing_hooks(common_name)
click to toggle source
# File lib/acmesmith/config.rb, line 77 def post_issuing_hooks(common_name) if @config.key?('post_issuing_hooks') && @config['post_issuing_hooks'].key?(common_name) specs = @config['post_issuing_hooks'][common_name] specs.flat_map do |specs_sub| specs_sub.map do |k, v| PostIssuingHooks.find(k).new(**v.map{ |k_,v_| [k_.to_sym, v_]}.to_h) end end else [] end end
storage()
click to toggle source
# File lib/acmesmith/config.rb, line 70 def storage @storage ||= begin c = @config['storage'].dup Storages.find(c.delete('type')).new(**c.map{ |k,v| [k.to_sym, v]}.to_h) end end
validate()
click to toggle source
# File lib/acmesmith/config.rb, line 20 def validate unless @config['storage'] raise ArgumentError, "config['storage'] must be provided" end if @config['endpoint'] and !@config['directory'] raise ArgumentError, "config['directory'] must be provided, e.g. https://acme-v02.api.letsencrypt.org/directory or https://acme-staging-v02.api.letsencrypt.org/directory\n\nNOTE: We have dropped ACME v1 support since acmesmith v2.0.0. Specify v2 directory API URL using config['directory']." end unless @config['directory'] raise ArgumentError, "config['directory'] must be provided, e.g. https://acme-v02.api.letsencrypt.org/directory or https://acme-staging-v02.api.letsencrypt.org/directory" end end