Class: KingslyCertbot::Configuration
- Inherits:
-
Object
- Object
- KingslyCertbot::Configuration
- Defined in:
- lib/kingsly_certbot/configuration.rb
Constant Summary collapse
- VARS =
%i[kingsly_server_host kingsly_server_port top_level_domain sub_domain kingsly_http_read_timeout kingsly_http_open_timeout sentry_dsn environment server_type ipsec_root].freeze
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Method Details
#validate! ⇒ Object
22 23 24 25 26 27 28 29 |
# 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 |