feat: add global .env file support#8
Conversation
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>
Code Review for PR #8: feat: add global .env file supportSummaryThis PR implements a global Overall Assessment: ✅ Approve Key Strengths:
Key Concerns:
Detailed Feedback1. Understanding & IntentWhat is this PR trying to accomplish? Does the title and description clearly communicate the purpose?
Are the changes scoped appropriately, or should this be split? Does the PR link to relevant issues/tickets? 2. Code Quality AssessmentArchitecture & DesignIs the solution well-architected? Appropriate abstraction level: Good separation of concerns: Follows existing patterns: local env_file_args=()
if [[ -f "$path" ]]; then
env_file_args+=(--env-file "$path")
log_info "..."
fiCode CorrectnessLogic correctness:
Edge cases:
Potential bugs: Code Style & ConsistencyDoes the code follow the project's style guidelines?
Is it consistent with existing code in the file? Naming:
Comments:
Security & SafetySecurity concerns:
Resource management: 3. Testing CoverageAre there tests for the new functionality? Do existing tests still pass? Are test cases meaningful? Missing test scenarios:
Note: The lack of tests is a project-wide concern, not specific to this PR. The implementation is simple enough that manual testing is sufficient. 4. Documentation & ImpactCode documentation:
User-facing documentation:
Breaking changes: Deprecations: 5. Performance & ScalabilityPerformance considerations:
Resource usage:
6. Maintainability & ReadabilityReadability: # Load global .env file first (PROJECT_DIR/.env will override)
local env_file_args=()
local agentbox_env="${HOME}/.agentbox/.env`
if [[ -f "$agentbox_env" ]]; then
env_file_args+=(--env-file "$agentbox_env")
log_info "Global .env loaded from ~/.agentbox/.env"
fiAny developer familiar with bash can understand this immediately. Extensibility:
7. Specific Line-by-Line FeedbackFile: agentbox Lines 376-383 - ✅ Excellent implementation # Load global .env file first (PROJECT_DIR/.env will override)
local env_file_args=()
local agentbox_env="${HOME}/.agentbox/.env`
if [[ -f "$agentbox_env" ]]; then
env_file_args+=(--env-file "$agentbox_env")
log_info "Global .env loaded from ~/.agentbox/.env`
fi
Lines 386-389 - ✅ Good update to existing code # Load project-specific .env (overrides global .env)
if [[ -f "$PROJECT_DIR/.env" ]]; then
env_file_args+=(--env_file "$PROJECT_DIR/.env")
log_info "Project .env file found and will be loaded into container"
fi
Minor nitpick (cosmetic only): log_info "Project .env loaded from $PROJECT_DIR/.env"However, this is purely cosmetic and the current message is acceptable. File: README.md Lines 138-149 - ✅ Excellent documentation
The documentation perfectly follows the project's philosophy:
What's Done Well
Action ItemsRequired Before MergeNone Recommended Improvements
VerdictThis PR is well-crafted and ready to merge. The implementation is clean, minimal, and perfectly aligned with the project's philosophy of simplicity and automatic behavior. The code is correct, well-documented, and maintains backward compatibility. Great work on:
The minor log message consistency suggestion is purely cosmetic and doesn't block merge. This PR exemplifies the project's development philosophy perfectly. Status: ✅ Ready to merge Reviewed by: Droid - GLM 4.7 |
Code Review: Global .env Support✅ Approve - This PR is ready to merge. Strengths
Code Quality
DocumentationClear explanation of load order with practical example for third-party inference providers. Documentation placement and messaging help users discover and understand the feature. Reviewed by: Amp Code |
✅ PR Merged SuccessfullyMerged to: dev branch SummaryThis PR adds global .env file support at ~/.agentbox/.env that loads before project-specific .env files, enabling centralized configuration for API keys and custom inference endpoints. Changes
Issues Resolved
🤖 Generated by Claude Code - GLM 4.7 |
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>
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>
…etchgqc#43) * fix: restrict GitHub Actions wildcard permissions to current PR (#4) 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. Co-authored-by: GLM <zai-org@users.noreply.github.com> * feat: add global .env file support (#8) 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>
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
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-hereBehavior
Alignment with Project Philosophy
🤖 Generated by Claude Code - GLM 4.7