Class: AgentSettings::EnvOverride
- Inherits:
-
Data
- Object
- Data
- AgentSettings::EnvOverride
- Defined in:
- lib/agent_settings/env_override.rb
Overview
Represents an environment variable that overrides config location.
Agents can use environment variables to override their default config locations. EnvOverride captures information about these variables, including their name, value, the resulting config path, and whether the override is active (i.e., the target file exists).
Supported environment variables by agent:
- Claude: CLAUDE_CONFIG_DIR
- OpenCode: OPENCODE_CONFIG, OPENCODE_CONFIG_DIR, OPENCODE_CONFIG_CONTENT
- Codex: CODEX_HOME
Instance Attribute Summary collapse
-
#active ⇒ Boolean
readonly
whether this override is in effect (file exists).
-
#agent ⇒ Symbol
readonly
the agent this override applies to.
-
#exists ⇒ Boolean
readonly
whether the config file exists at this path.
-
#name ⇒ String
readonly
the environment variable name (e.g., 'CLAUDE_CONFIG_DIR').
-
#note ⇒ String
readonly
description of what this override does.
-
#path ⇒ String
readonly
the resulting config file path.
-
#value ⇒ String
readonly
the value of the environment variable.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Whether this override is in effect.
-
#exists? ⇒ Boolean
Whether the config file exists at this path.
-
#to_location ⇒ Location
Convert this override to a Location object.
Instance Attribute Details
#active ⇒ Boolean (readonly)
whether this override is in effect (file exists)
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def active @active end |
#agent ⇒ Symbol (readonly)
the agent this override applies to
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def agent @agent end |
#exists ⇒ Boolean (readonly)
whether the config file exists at this path
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def exists @exists end |
#name ⇒ String (readonly)
the environment variable name (e.g., 'CLAUDE_CONFIG_DIR')
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def name @name end |
#note ⇒ String (readonly)
description of what this override does
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def note @note end |
#path ⇒ String (readonly)
the resulting config file path
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def path @path end |
#value ⇒ String (readonly)
the value of the environment variable
35 36 37 |
# File 'lib/agent_settings/env_override.rb', line 35 def value @value end |
Instance Method Details
#active? ⇒ Boolean
Returns whether this override is in effect.
40 |
# File 'lib/agent_settings/env_override.rb', line 40 def active? = active |
#exists? ⇒ Boolean
Returns whether the config file exists at this path.
37 |
# File 'lib/agent_settings/env_override.rb', line 37 def exists? = exists |
#to_location ⇒ Location
Convert this override to a Location object.
When an environment override is active, it becomes the effective config location. This method converts the override to a Location with scope :env.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/agent_settings/env_override.rb', line 49 def to_location Location.new( agent: agent, scope: :env, source: name, path: path, exists: exists, active: active, note: note ) end |