Module: Pbx::Config

Defined in:
lib/pbx/config.rb

Defined Under Namespace

Classes: Error, Value

Constant Summary collapse

DEFAULTS =
{
  host: "127.0.0.1",
  port: 5038,
  user: nil,
  secret: nil,
  context: "default",
  reconnect_backoff: [1, 2, 5, 10]
}.freeze

Class Method Summary collapse

Class Method Details

.load(cli: {}) ⇒ Object



24
25
26
27
28
# File 'lib/pbx/config.rb', line 24

def self.load(cli: {})
  from_yaml = cli[:config] ? load_yaml(cli[:config]) : {}
  merged = DEFAULTS.merge(from_yaml).merge(compact(cli).except(:config))
  Value.new(**merged)
end