Class: Agent::SessionContext::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/session_context/config.rb

Constant Summary collapse

DEFAULT_TIMEOUT_SECONDS =
300
MIN_TIMEOUT_SECONDS =
1
MAX_TIMEOUT_SECONDS =
3600

Class Method Summary collapse

Class Method Details

.load(session:, env: ENV, timeout: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/agent/session_context/config.rb', line 18

def load(session:, env: ENV, timeout: nil)
  project_timeout = load_layer(project_source(session))
  user_timeout = load_layer(user_source(env))

  effective_timeout =
    if timeout.nil?
      if project_timeout.nil?
        user_timeout.nil? ? DEFAULT_TIMEOUT_SECONDS : user_timeout
      else
        project_timeout
      end
    else
      validate_timeout!(timeout, source: "timeout")
    end

  new(timeout_seconds: effective_timeout)
end