Class: Hyperion::Config::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/config.rb

Overview

DSL receiver. Each method call on the DSL maps to a Config setter or to a hook registration. Unknown methods raise NoMethodError so typos surface immediately at boot rather than as silent ignores.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ DSL

Returns a new instance of DSL.



76
77
78
# File 'lib/hyperion/config.rb', line 76

def initialize(config)
  @config = config
end

Instance Method Details

#bind(value) ⇒ Object

‘bind` is the Puma-style alias for `host` — operators expect it.



81
82
83
# File 'lib/hyperion/config.rb', line 81

def bind(value)
  @config.host = value
end

#tls_cert_path(path) ⇒ Object

‘tls_cert_path` / `tls_key_path` are convenience aliases that read the file off disk so the DSL stays terse. The parsed cert/key are stored on the config and Server consumes them directly.



100
101
102
103
# File 'lib/hyperion/config.rb', line 100

def tls_cert_path(path)
  require 'openssl'
  @config.tls_cert = OpenSSL::X509::Certificate.new(File.read(path))
end

#tls_key_path(path) ⇒ Object



105
106
107
108
# File 'lib/hyperion/config.rb', line 105

def tls_key_path(path)
  require 'openssl'
  @config.tls_key = OpenSSL::PKey.read(File.read(path))
end