Documentation
¶
Overview ¶
Package config resolves deploy's environment into its canonical Liquid Proto contract.
The package owns the environment vocabulary, the validation that rejects an unusable process environment outright, and the small accessors that project the resolved contract into the Go values the rest of Core consumes. The variable names and defaults in environment_generated.go are generated from the repository-root Candacefile by tools/candace_environment.py and are not written by hand.
Callers may rely on Load and LoadForHarness returning a fully validated *deployv1.CoreConfig or an error, never a partially populated one, and on Loader keeping the environment source replaceable for embedding and tests without widening Core's configuration vocabulary. Resolution is pure: the package opens no connections, starts nothing, and never mutates the process environment.
Index ¶
- Constants
- Variables
- func ApprovalTimeout(resolved *deployv1.CoreConfig) time.Duration
- func CopilotHome(resolved *deployv1.CoreConfig) string
- func FleetPollInterval(resolved *deployv1.CoreConfig) time.Duration
- func HarnessBackendName(backend deployv1.HarnessBackend) string
- func Load() (*deployv1.CoreConfig, error)
- func LoadForHarness(backend deployv1.HarnessBackend) (*deployv1.CoreConfig, error)
- func NodeLabels(resolved *deployv1.CoreConfig) map[string]map[string]string
- func Validate(resolved *deployv1.CoreConfig) error
- type Loader
Constants ¶
const ( EnvironmentPostgresDatabase = "POSTGRES_DB" DefaultPostgresDatabase = "deploy" EnvironmentPostgresUser = "POSTGRES_USER" DefaultPostgresUser = "deploy" EnvironmentPostgresPassword = "POSTGRES_PASSWORD" EnvironmentStateRoot = "DEPLOY_STATE_ROOT" EnvironmentUID = "DEPLOY_UID" EnvironmentGID = "DEPLOY_GID" EnvironmentHostWorkspace = "DEPLOY_HOST_WORKSPACE" EnvironmentAgentToken = "NODEEXEC_TOKEN" EnvironmentCopilotConnectionToken = "DEPLOY_COPILOT_CONNECTION_TOKEN" EnvironmentOpenCodePassword = "DEPLOY_OPENCODE_PASSWORD" EnvironmentCopilotGitHubToken = "COPILOT_GITHUB_TOKEN" DefaultCopilotGitHubToken = "" EnvironmentOpenCodeModel = "DEPLOY_OPENCODE_MODEL" DefaultOpenCodeModel = "" EnvironmentAgentRevisionMaxEntries = "NODEEXEC_REVISION_MAX_ENTRIES" DefaultAgentRevisionMaxEntries = "128" EnvironmentAgentRevisionMaxBytes = "NODEEXEC_REVISION_MAX_BYTES" DefaultAgentRevisionMaxBytes = "4294967296" EnvironmentCopilotBin = "DEPLOY_COPILOT_BIN" EnvironmentCopilotSHA256 = "DEPLOY_COPILOT_SHA256" EnvironmentGHToken = "GH_TOKEN" EnvironmentGitHubToken = "GITHUB_TOKEN" EnvironmentLiveConfirm = "DEPLOY_LIVE_CONFIRM" EnvironmentLegacyMode = "DEPLOY_MODE" EnvironmentOpenAIAPIKey = "OPENAI_API_KEY" EnvironmentAnthropicAPIKey = "ANTHROPIC_API_KEY" EnvironmentOpenRouterAPIKey = "OPENROUTER_API_KEY" EnvironmentAgentBind = "NODEEXEC_BIND" DefaultAgentBind = "0.0.0.0:8094" EnvironmentAgentNodeID = "NODEEXEC_NODE_ID" DefaultAgentNodeID = "deploy-demo" EnvironmentAgentStateFile = "NODEEXEC_STATE_FILE" DefaultAgentStateFile = "/var/lib/nodeexec/state.json" EnvironmentAgentRevisionRoot = "NODEEXEC_REVISION_ROOT" DefaultAgentRevisionRoot = "/var/lib/nodeexec/revisions" EnvironmentDockerConfig = "DOCKER_CONFIG" DefaultDockerConfig = "/tmp/docker-config" EnvironmentAgentDryWorkspace = "NODEEXEC_DRY_WORKSPACE" DefaultAgentDryWorkspace = "/workspace" EnvironmentAgentLiveWorkspace = "NODEEXEC_LIVE_WORKSPACE" DefaultAgentLiveWorkspace = "/workspace" EnvironmentAgentDryRunEnabled = "NODEEXEC_DRY_RUN_ENABLED" DefaultAgentDryRunEnabled = "true" EnvironmentAgentDryRunDisabled = "NODEEXEC_DRY_RUN_DISABLED" DefaultAgentDryRunDisabled = "false" EnvironmentWardenConfig = "WARDEN_CONFIG" DefaultWardenConfig = "/etc/warden/warden.yaml" EnvironmentWardenLogFormat = "WARDEN_LOG_FORMAT" DefaultWardenLogFormat = "console" EnvironmentCopilotHome = "DEPLOY_COPILOT_HOME" DefaultCopilotHome = "/var/lib/copilot" EnvironmentHarnessBackend = "DEPLOY_HARNESS_BACKEND" DefaultHarnessBackend = "copilot-cli" EnvironmentCoreBind = "DEPLOY_BIND" DefaultCoreBind = "0.0.0.0:7780" EnvironmentCoreDataDir = "DEPLOY_DATA_DIR" DefaultCoreDataDir = "/var/lib/deploy" EnvironmentCoreWorkspace = "DEPLOY_WORKSPACE" DefaultCoreWorkspace = "/workspace" EnvironmentCoreDatabaseURL = "DEPLOY_DATABASE_URL" DefaultCoreDatabaseURL = "" EnvironmentCoreWardenURL = "DEPLOY_WARDEN_URL" DefaultCoreWardenURL = "http://127.0.0.1:7717" EnvironmentCoreAgentURL = "NODEEXEC_URL" DefaultCoreAgentURL = "" EnvironmentCoreAgentPort = "NODEEXEC_PORT" DefaultCoreAgentPort = "8094" EnvironmentCoreNodeLabels = "DEPLOY_NODE_LABELS" DefaultCoreNodeLabels = "{}" EnvironmentCoreApprovalTimeout = "DEPLOY_APPROVAL_TIMEOUT" DefaultCoreApprovalTimeout = "15m" EnvironmentCoreFleetPollInterval = "DEPLOY_FLEET_POLL_INTERVAL" DefaultCoreFleetPollInterval = "2s" EnvironmentCopilotCLI = "DEPLOY_COPILOT_CLI" DefaultCopilotCLI = "/usr/local/bin/copilot" EnvironmentCopilotURL = "DEPLOY_COPILOT_URL" DefaultCopilotURL = "" EnvironmentCopilotModel = "DEPLOY_COPILOT_MODEL" DefaultCopilotModel = "gpt-5.4" EnvironmentOllamaURL = "DEPLOY_OLLAMA_URL" DefaultOllamaURL = "" EnvironmentOllamaModel = "DEPLOY_OLLAMA_MODEL" DefaultOllamaModel = "" EnvironmentOllamaModelDigest = "DEPLOY_OLLAMA_MODEL_DIGEST" DefaultOllamaModelDigest = "" EnvironmentOllamaContextTokens = "DEPLOY_OLLAMA_CONTEXT_TOKENS" DefaultOllamaContextTokens = "16384" EnvironmentOllamaMaxToolCalls = "DEPLOY_OLLAMA_MAX_TOOL_CALLS" DefaultOllamaMaxToolCalls = "16" EnvironmentOllamaTurnTimeout = "DEPLOY_OLLAMA_TURN_TIMEOUT" DefaultOllamaTurnTimeout = "10m" EnvironmentOpenCodeURL = "DEPLOY_OPENCODE_URL" DefaultOpenCodeURL = "http://127.0.0.1:4096" EnvironmentOpenCodeUsername = "DEPLOY_OPENCODE_USERNAME" DefaultOpenCodeUsername = "opencode" EnvironmentOpenCodeSessionID = "DEPLOY_OPENCODE_SESSION_ID" DefaultOpenCodeSessionID = "" EnvironmentOpenCodeRequestTimeout = "DEPLOY_OPENCODE_REQUEST_TIMEOUT" DefaultOpenCodeRequestTimeout = "10s" EnvironmentOpenCodePollInterval = "DEPLOY_OPENCODE_POLL_INTERVAL" DefaultOpenCodePollInterval = "1s" EnvironmentOpenCodeQueueCapacity = "DEPLOY_OPENCODE_QUEUE_CAPACITY" DefaultOpenCodeQueueCapacity = "32" EnvironmentLiveConfirmPhrase = "DEPLOY_LIVE_CONFIRM_PHRASE" DefaultLiveConfirmPhrase = "I_UNDERSTAND_DOCKER_SOCKET_IS_ROOT" ProfileLocal = "local" ProfileLocalAgentRevisionRoot = "{{state_root}}/revisions" ProfileLocalAgentLiveWorkspace = "{{host_workspace}}" ProfileLocalCoreDatabaseURL = "postgres://deploy:{{postgres_password}}@postgres:5432/deploy?sslmode=disable" ProfileLocalCoreWardenURL = "http://warden:7717" ProfileLocalCoreAgentURL = "http://nodeexec:8094" ProfileLocalCoreNodeLabels = "{\"deploy-demo\":{\"environment\":\"prototype\",\"runtime\":\"compose\"}}" ProfileDemo = "demo" ProfileDemoHarnessBackend = "demo" ProfileDemoCopilotURL = "" ProfileDemoOpenCodeURL = "" ProfileCopilot = "copilot" ProfileCopilotHarnessBackend = "copilot-cli" ProfileCopilotCopilotURL = "http://copilot:4321" ProfileCopilotOpenCodeURL = "" ProfileOpenCode = "opencode" ProfileOpenCodeHarnessBackend = "opencode" ProfileOpenCodeCopilotURL = "" ProfileOpenCodeOpenCodeURL = "http://opencode:4096" )
Variables ¶
var EnvironmentNames = [...]string{ EnvironmentPostgresDatabase, EnvironmentPostgresUser, EnvironmentPostgresPassword, EnvironmentStateRoot, EnvironmentUID, EnvironmentGID, EnvironmentHostWorkspace, EnvironmentAgentToken, EnvironmentCopilotConnectionToken, EnvironmentOpenCodePassword, EnvironmentCopilotGitHubToken, EnvironmentOpenCodeModel, EnvironmentAgentRevisionMaxEntries, EnvironmentAgentRevisionMaxBytes, EnvironmentCopilotBin, EnvironmentCopilotSHA256, EnvironmentGHToken, EnvironmentGitHubToken, EnvironmentLiveConfirm, EnvironmentLegacyMode, EnvironmentOpenAIAPIKey, EnvironmentAnthropicAPIKey, EnvironmentOpenRouterAPIKey, EnvironmentAgentBind, EnvironmentAgentNodeID, EnvironmentAgentStateFile, EnvironmentAgentRevisionRoot, EnvironmentDockerConfig, EnvironmentAgentDryWorkspace, EnvironmentAgentLiveWorkspace, EnvironmentAgentDryRunEnabled, EnvironmentAgentDryRunDisabled, EnvironmentWardenConfig, EnvironmentWardenLogFormat, EnvironmentCopilotHome, EnvironmentHarnessBackend, EnvironmentCoreBind, EnvironmentCoreDataDir, EnvironmentCoreWorkspace, EnvironmentCoreDatabaseURL, EnvironmentCoreWardenURL, EnvironmentCoreAgentURL, EnvironmentCoreAgentPort, EnvironmentCoreNodeLabels, EnvironmentCoreApprovalTimeout, EnvironmentCoreFleetPollInterval, EnvironmentCopilotCLI, EnvironmentCopilotURL, EnvironmentCopilotModel, EnvironmentOllamaURL, EnvironmentOllamaModel, EnvironmentOllamaModelDigest, EnvironmentOllamaContextTokens, EnvironmentOllamaMaxToolCalls, EnvironmentOllamaTurnTimeout, EnvironmentOpenCodeURL, EnvironmentOpenCodeUsername, EnvironmentOpenCodeSessionID, EnvironmentOpenCodeRequestTimeout, EnvironmentOpenCodePollInterval, EnvironmentOpenCodeQueueCapacity, EnvironmentLiveConfirmPhrase, }
EnvironmentNames lists every environment variable the deploy environment declares, in Candacefile order.
Functions ¶
func ApprovalTimeout ¶
func ApprovalTimeout(resolved *deployv1.CoreConfig) time.Duration
ApprovalTimeout is how long a pending approval may wait before the queue fails it closed.
func CopilotHome ¶
func CopilotHome(resolved *deployv1.CoreConfig) string
CopilotHome is the Copilot adapter's private state directory inside the resolved data directory. It is never shared with another harness backend.
func FleetPollInterval ¶
func FleetPollInterval(resolved *deployv1.CoreConfig) time.Duration
FleetPollInterval is how often Core refreshes its Warden membership view.
func HarnessBackendName ¶
func HarnessBackendName(backend deployv1.HarnessBackend) string
HarnessBackendName is the environment spelling of a harness backend enum, the value DEPLOY_HARNESS_BACKEND accepts.
func Load ¶
func Load() (*deployv1.CoreConfig, error)
Load resolves the current process environment.
func LoadForHarness ¶
func LoadForHarness(backend deployv1.HarnessBackend) (*deployv1.CoreConfig, error)
LoadForHarness resolves the current process environment for an implementation selected by the embedding binary. Provider-specific environment is loaded only for built-in harnesses selected through Load.
func NodeLabels ¶
func NodeLabels(resolved *deployv1.CoreConfig) map[string]map[string]string
NodeLabels projects the canonical node contracts into the map consumed by the current fleet and reconciliation adapters. The returned maps are copies.
func Validate ¶
func Validate(resolved *deployv1.CoreConfig) error
Validate applies generated Liquid predicates first, then the OS, URL, and cross-field checks that the refinement grammar intentionally does not own.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader resolves one environment source into Core's canonical Liquid Proto contract. The concrete loader keeps process input replaceable for embedding and tests without expanding Core's configuration vocabulary.
func NewLoader ¶
func NewLoader(environment runtimeconfig.Environment) Loader
NewLoader constructs a Core configuration loader over environment.
func (Loader) Load ¶
func (loader Loader) Load() (*deployv1.CoreConfig, error)
Load resolves the loader's environment-selected built-in harness.
func (Loader) LoadForHarness ¶
func (loader Loader) LoadForHarness(backend deployv1.HarnessBackend) (*deployv1.CoreConfig, error)
LoadForHarness resolves the loader's environment around a compiled-in implementation. Environment cannot replace the supplied backend.