class KingslyCertbot::Configuration

Constants

VARS

Public Class Methods

new(params = {}) click to toggle source
# File lib/kingsly_certbot/configuration.rb, line 9
def initialize(params = {})
  @kingsly_http_read_timeout = 300
  @kingsly_http_open_timeout = 20
  @sentry_dsn = params['SENTRY_DSN']
  @environment = params['ENVIRONMENT'] || 'development'
  @top_level_domain = params['TOP_LEVEL_DOMAIN']
  @sub_domain = params['SUB_DOMAIN']
  @kingsly_server_host = params['KINGSLY_SERVER_HOST']
  @kingsly_server_port = params['KINGSLY_SERVER_PORT']
  @server_type = params['SERVER_TYPE']
  @ipsec_root = params['IPSEC_ROOT'] || '/'
end

Public Instance Methods

validate!() click to toggle source
# File lib/kingsly_certbot/configuration.rb, line 22
def validate!
  %i[top_level_domain sub_domain kingsly_server_host kingsly_server_port server_type].each do |mandatory|
    raise "Missing mandatory config '#{mandatory}'" if send(mandatory).nil? || send(mandatory) == ''
  end
  raise "Unsupported server_type '#{server_type}'" unless ['ipsec'].include?(server_type)

  self
end