-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for environment variables passed to token command #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 1 1
Lines 180 202 +22
=====================================
- Misses 180 202 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for passing environment variables to the token command, allowing both a passthrough of the host environment and specification of additional variables.
- Added Env and EnvPassthrough fields to ForgeConfig in main.go
- Updated token command execution in main.go to set the command environment accordingly
- Updated example configuration and README documentation to illustrate usage
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
main.go | Added logic to set environment variables for the token command based on the new config. |
example/forge.yaml | Provided an example configuration for both passthrough and specific environment variables. |
README.md | Updated documentation to include details for the new environment variable options. |
… and existing variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for injecting environment variables into the token command execution by introducing two new ForgeConfig fields.
- Introduce
env
map andenv_passthrough
flag to control environment variables for the token command - Merge and override environment variables before running the token command in
main.go
- Update example config and README to document the new options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
main.go | Merge os.Environ() and/or cfg.Env into cmd.Env based on env_passthrough |
example/forge.yaml | Show how to configure env (with commented env_passthrough ) |
README.md | Document env and env_passthrough options |
Comments suppressed due to low confidence (1)
main.go:169
- There are no unit tests covering the new
env
andenv_passthrough
merge behavior; adding tests for different combinations would improve confidence.
cmd.Env = envList
@@ -142,6 +145,36 @@ func makeHandler(cfg ForgeConfig, tcfg ToolConfig) server.ToolHandlerFunc { | |||
cmd = exec.Command("sh", "-c", cfg.TokenCommand) | |||
} | |||
|
|||
// Build merged environment: start with os.Environ() if passthrough, else start empty, | |||
// then overlay values from cfg.Env to ensure overrides. | |||
var envList []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The in-place filtering using envList[:0]
can be non-obvious; consider extracting the environment merge logic into a helper or using a fresh slice for clarity.
Copilot uses AI. Check for mistakes.
|
||
# All of the environment variables passed to mcp-graphql-forge will be passed when invoking the token command. | ||
# env_passthrough: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Uncomment or provide a live example of env_passthrough: true
so users can see how to enable full environment passthrough along with overrides.
Copilot uses AI. Check for mistakes.
No description provided.