Class: Legion::TTY::Background::BootstrapConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/tty/background/bootstrap_config.rb

Constant Summary collapse

ENV_KEY =
'LEGIONIO_BOOTSTRAP_CONFIG'
SETTINGS_DIR =
File.expand_path('~/.legionio/settings')

Instance Method Summary collapse

Constructor Details

#initialize(logger: nil) ⇒ BootstrapConfig

Returns a new instance of BootstrapConfig.



16
17
18
# File 'lib/legion/tty/background/bootstrap_config.rb', line 16

def initialize(logger: nil)
  @log = logger
end

Instance Method Details

#run_async(queue) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/legion/tty/background/bootstrap_config.rb', line 20

def run_async(queue)
  Thread.new do
    result = perform_bootstrap
    queue.push(result)
  rescue StandardError => e
    @log&.log('bootstrap', "ERROR: #{e.class}: #{e.message}")
    queue.push({ type: :bootstrap_error, error: e.message })
  end
end