mirror of
https://github.com/coleam00/Archon
synced 2026-04-21 21:47:53 +00:00
Add per-project environment variable management as a first-class config primitive. Env vars defined in .archon/config.yaml or stored in DB via Web UI are merged into Options.env on Claude SDK calls. Three env var sources merge in priority order (later wins): 1. process.env — global, from ~/.archon/.env via dotenv 2. .archon/config.yaml env: section — file-based per-project 3. DB remote_agent_codebase_env_vars table — Web UI per-project Changes: - Add remote_agent_codebase_env_vars table (PG migration + SQLite schema) - Add DB CRUD module (packages/core/src/db/env-vars.ts) - Extend IWorkflowStore with getCodebaseEnvVars method - Add env field to RepoConfig, MergedConfig, WorkflowConfig, WorkflowAssistantOptions, AssistantRequestOptions - Merge DB env vars in executor after config load - Inject env vars into Claude subprocess via Options.env - Add 3 API routes (GET/PUT/DELETE /api/codebases/:id/env) - Add EnvVarsPanel to Settings page with masked value display Fixes #852
20 lines
920 B
SQL
20 lines
920 B
SQL
-- Per-codebase environment variables for workflow node injection
|
|
-- Version: 20.0
|
|
-- Description: Stores per-project env vars managed via Web UI or .archon/config.yaml.
|
|
-- Merged into Options.env on Claude SDK calls. No encryption — same security as codebases table.
|
|
|
|
CREATE TABLE IF NOT EXISTS remote_agent_codebase_env_vars (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
codebase_id UUID NOT NULL REFERENCES remote_agent_codebases(id) ON DELETE CASCADE,
|
|
key VARCHAR(255) NOT NULL,
|
|
value TEXT NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
UNIQUE(codebase_id, key)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_codebase_env_vars_codebase_id
|
|
ON remote_agent_codebase_env_vars(codebase_id);
|
|
|
|
COMMENT ON TABLE remote_agent_codebase_env_vars IS
|
|
'Per-project env vars merged into Options.env on Claude SDK calls. Managed via Web UI or config.';
|