Skip to content

feat: add global .env file support#7

Closed
shrwnsan wants to merge 3 commits into
mainfrom
feat/global-env
Closed

feat: add global .env file support#7
shrwnsan wants to merge 3 commits into
mainfrom
feat/global-env

Conversation

@shrwnsan
Copy link
Copy Markdown
Owner

@shrwnsan shrwnsan commented Jan 8, 2026

Summary

Implements global .env file support at ~/.agentbox/.env that loads before project-specific .env files, enabling centralized configuration for API keys and custom inference endpoints.

Closes #6

Changes

  • agentbox: Load ~/.agentbox/.env first, then PROJECT_DIR/.env
  • Project env vars override global vars (Docker's last-wins precedence)
  • Added log message for discoverability when global .env is loaded
  • README.md: Document global .env usage with examples

Use Case

Configure third-party inference providers (e.g., non-Anthropic inference services) without needing to set credentials per-project:

# ~/.agentbox/.env
ANTHROPIC_BASE_URL=https://api.example.com/v1
ANTHROPIC_API_KEY=your-shared-key-here

Behavior

  1. Global .env loaded first (if exists)
  2. Project .env loaded second (if exists)
  3. Project values override global values

Alignment with Project Philosophy

  • Simplicity First: ~10 lines of code, no complex configuration
  • Automatic Behavior: No prompts, just works if file exists
  • Fail Gracefully: Silent skip if file doesn't exist

🤖 Generated by Claude Code - GLM 4.7

shrwnsan and others added 3 commits January 7, 2026 18:59
Add comprehensive security review documentation with findings
for high and medium severity issues including supply chain
risks, GitHub Actions permissions, and secret exposure.

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
Scope gh pr comment permissions to only the PR being reviewed
by using PR number variable instead of wildcard. Prevents
compromised workflow token from commenting on arbitrary PRs.

Resolves #2

Co-authored-by: GLM <zai-org@users.noreply.github.com>
Add support for ~/.agentbox/.env that loads before project-specific
.env files. This enables centralized configuration for API keys and
custom inference endpoints across all projects.

Changes:
- Load ~/.agentbox/.env first, then PROJECT_DIR/.env
- Project env vars override global vars (Docker's last-wins behavior)
- Add log message for discoverability when global .env is loaded
- Document global .env usage in README with examples

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
@shrwnsan
Copy link
Copy Markdown
Owner Author

shrwnsan commented Jan 8, 2026

Closing - will recreate against dev branch (main is for upstream tracking only)

@shrwnsan shrwnsan closed this Jan 8, 2026
@shrwnsan shrwnsan deleted the feat/global-env branch January 9, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant