Skip to content

Use a config filename that is different from the binary name #46

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 1 commit into from
Mar 28, 2025

Conversation

williammartin
Copy link
Collaborator

@williammartin williammartin commented Mar 28, 2025

Description

This was causing issues in the Docker container, where viper looks for a filename, without considering the extension, resulting in it trying to parse the binary itself as JSON:

➜ github-mcp-server git:(main) ✗ docker run -itt -e GITHUB_PERSONAL_ACCESS_TOKEN=foo github/github-mcp-server
2025/03/28 10:04:19 Could not read JSON config: While parsing config: invalid character '\x7f' looking for beginning of value

There are probably more robust options out there, like looking in config dirs (XDG, if this was ever user installed) but this is the simplest path to fix the error.

This was causing issues in the Docker container, where viper looks for a
filename, without considering the extension, resulting in it trying to
parse the binary itself as JSON.
@Copilot Copilot AI review requested due to automatic review settings March 28, 2025 10:19
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 addresses issues with viper misinterpreting the binary as a JSON config by changing the config filename.

  • Updates the config name in the viper configuration to "github-mcp-server-config".
  • Changes the JSON filename in the DumpTranslationKeyMap function to "github-mcp-server-config.json".
Comments suppressed due to low confidence (2)

pkg/translations/translations.go:27

  • [nitpick] Consider defining a constant for the config name to avoid duplicating literal strings across the codebase.
v.SetConfigName("github-mcp-server-config")

pkg/translations/translations.go:64

  • [nitpick] Consider using a constant for the config filename to maintain consistency and ease future changes.
file, err := os.Create("github-mcp-server-config.json")

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@williammartin williammartin merged commit 001a665 into main Mar 28, 2025
13 checks passed
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this pull request Apr 12, 2025
This was causing issues in the Docker container, where viper looks for a
filename, without considering the extension, resulting in it trying to
parse the binary itself as JSON.
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.

3 participants