Skip to content

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

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

JaredHatfield
Copy link
Member

No description provided.

Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (0469be7) to head (68ebe01).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
main.go 0.00% 22 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@Copilot Copilot AI left a 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.

@JaredHatfield JaredHatfield requested a review from Copilot June 3, 2025 02:06
@JaredHatfield JaredHatfield merged commit 65a16b5 into main Jun 3, 2025
5 checks passed
@JaredHatfield JaredHatfield deleted the env branch June 3, 2025 02:07
@github-project-automation github-project-automation bot moved this from Todo to Done in UnitVectorY Labs Jun 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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 and env_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 and env_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
Copy link
Preview

Copilot AI Jun 3, 2025

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
Copy link
Preview

Copilot AI Jun 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant