Class: Kitsune::Kit::Configuration::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/kitsune/kit/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Service

Returns a new instance of Service.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/kitsune/kit/configuration.rb', line 49

def initialize(**attributes)
  super(
    enabled: boolean(attributes.fetch(:enabled)),
    mode: attributes.fetch(:mode, "managed").to_s,
    host: attributes[:host]&.to_s,
    image: attributes.fetch(:image).to_s,
    publish: boolean(attributes.fetch(:publish)),
    bind: attributes.fetch(:bind).to_s,
    allowed_cidrs: Array(attributes.fetch(:allowed_cidrs)).map(&:to_s).freeze,
    port: Integer(attributes.fetch(:port)),
    password_env: attributes.fetch(:password_env).to_s
  )
rescue ArgumentError, TypeError
  raise Errors::ConfigurationError, "service port must be an integer"
end