Class: Kitsune::Kit::Application
- Inherits:
-
Object
- Object
- Kitsune::Kit::Application
- Defined in:
- lib/kitsune/kit/application.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#event_bus ⇒ Object
readonly
Returns the value of attribute event_bus.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#secret_store ⇒ Object
readonly
Returns the value of attribute secret_store.
-
#state_store ⇒ Object
readonly
Returns the value of attribute state_store.
-
#transport_factory ⇒ Object
readonly
Returns the value of attribute transport_factory.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config:, provider:, state_store:, transport_factory: nil, event_bus: Events::Bus.new, secret_store: SecretStores::Environment.new, maximum_timeout: nil) ⇒ Application
constructor
A new instance of Application.
- #operations ⇒ Object
- #service_operation(type) ⇒ Object
Constructor Details
#initialize(config:, provider:, state_store:, transport_factory: nil, event_bus: Events::Bus.new, secret_store: SecretStores::Environment.new, maximum_timeout: nil) ⇒ Application
Returns a new instance of Application.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/kitsune/kit/application.rb', line 42 def initialize(config:, provider:, state_store:, transport_factory: nil, event_bus: Events::Bus.new, secret_store: SecretStores::Environment.new, maximum_timeout: nil) @config = config @provider = provider @state_store = state_store @transport_factory = transport_factory @secret_store = secret_store @event_bus = event_bus @maximum_timeout = maximum_timeout end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def config @config end |
#event_bus ⇒ Object (readonly)
Returns the value of attribute event_bus.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def event_bus @event_bus end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def provider @provider end |
#secret_store ⇒ Object (readonly)
Returns the value of attribute secret_store.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def secret_store @secret_store end |
#state_store ⇒ Object (readonly)
Returns the value of attribute state_store.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def state_store @state_store end |
#transport_factory ⇒ Object (readonly)
Returns the value of attribute transport_factory.
15 16 17 |
# File 'lib/kitsune/kit/application.rb', line 15 def transport_factory @transport_factory end |
Class Method Details
.build(root:, environment:, config_path: nil, overrides: {}, env: ENV, event_bus: Events::Bus.new, host_key_confirmation: nil, maximum_timeout: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/kitsune/kit/application.rb', line 17 def self.build(root:, environment:, config_path: nil, overrides: {}, env: ENV, event_bus: Events::Bus.new, host_key_confirmation: nil, maximum_timeout: nil) config = Configuration::Loader.new(root: root, env: env, config_path: config_path) .load(environment: environment, overrides: overrides) token = env.fetch(config.provider.token_env, "") provider = Adapters::DigitalOceanProvider.new(token: token, maximum_timeout: maximum_timeout) state_store = StateStore.new(root: root) transport_factory = Adapters::TransportFactory.new( config: config, provider: provider, root: root, host_key_confirmation: host_key_confirmation, maximum_timeout: maximum_timeout ) new( config: config, provider: provider, state_store: state_store, transport_factory: transport_factory, secret_store: SecretStores::Environment.new(env: env), event_bus: event_bus, maximum_timeout: maximum_timeout ) end |
Instance Method Details
#operations ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/kitsune/kit/application.rb', line 53 def operations values = [Operations::EnsureServer.new( config: config, provider: provider, state_store: state_store, maximum_timeout: @maximum_timeout )] values.concat(remote_operations) if @transport_factory values.concat(service_operations) if @transport_factory if config.dns.domains.any? values << Operations::EnsureDnsRecords.new(config: config, provider: provider, state_store: state_store) end values end |
#service_operation(type) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/kitsune/kit/application.rb', line 65 def service_operation(type) Operations::EnsureService.new( config: config, type: type, transport_factory: @transport_factory, state_store: state_store, secret_store: secret_store ) end |