Module: Legion::Mode

Defined in:
lib/legion/mode.rb

Constant Summary collapse

LEGACY_MAP =
{ full: :agent, api: :worker, router: :worker, worker: :worker, lite: :lite }.freeze

Class Method Summary collapse

Class Method Details

.agent?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/legion/mode.rb', line 16

def agent?
  current == :agent
end

.currentObject



8
9
10
11
12
13
14
# File 'lib/legion/mode.rb', line 8

def current
  raw = ENV['LEGION_MODE'] ||
        settings_dig(:mode) ||
        settings_dig(:process, :mode) ||
        legacy_role
  normalize(raw)
end

.infra?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/legion/mode.rb', line 24

def infra?
  current == :infra
end

.lite?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/legion/mode.rb', line 28

def lite?
  current == :lite
end

.worker?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/legion/mode.rb', line 20

def worker?
  current == :worker
end