Class: R509::CertificateAuthority::HTTP::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/r509/certificateauthority/http/config.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) load_config(config_file = "config.yaml")



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/r509/certificateauthority/http/config.rb', line 3

def self.load_config(config_file = "config.yaml")
  config_data = File.read(config_file)

  Dependo::Registry[:config_pool] = R509::Config::CAConfigPool.from_yaml("certificate_authorities", config_data)

  Dependo::Registry[:crls] = {}
  Dependo::Registry[:options_builders] = {}
  Dependo::Registry[:certificate_authorities] = {}
  Dependo::Registry[:config_pool].names.each do |name|
    Dependo::Registry[:crls][name] = R509::CRL::Administrator.new(Dependo::Registry[:config_pool][name])
    Dependo::Registry[:options_builders][name] = R509::CertificateAuthority::OptionsBuilder.new(Dependo::Registry[:config_pool][name])
    Dependo::Registry[:certificate_authorities][name] = R509::CertificateAuthority::Signer.new(Dependo::Registry[:config_pool][name])
  end
end


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/r509/certificateauthority/http/config.rb', line 18

def self.print_config
  Dependo::Registry[:log].warn "Config loaded"
  Dependo::Registry[:config_pool].all.each do |config|
    Dependo::Registry[:log].warn "Config: "
    Dependo::Registry[:log].warn "CA Cert:"+config.ca_cert.subject.to_s
    Dependo::Registry[:log].warn "OCSP Cert (may be the same as above):"+config.ocsp_cert.subject.to_s
    Dependo::Registry[:log].warn "OCSP Validity Hours: "+config.ocsp_validity_hours.to_s
    Dependo::Registry[:log].warn "CRL Validity Hours: "+config.crl_validity_hours.to_s
    Dependo::Registry[:log].warn "\n"
  end
end