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.



83
84
85
# File 'lib/hyperion/config.rb', line 83

def initialize(config)
  @config = config
end

Instance Method Details

#bind(value) ⇒ Object

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



88
89
90
# File 'lib/hyperion/config.rb', line 88

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.



107
108
109
110
# File 'lib/hyperion/config.rb', line 107

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

#tls_key_path(path) ⇒ Object



112
113
114
115
# File 'lib/hyperion/config.rb', line 112

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