Skip to content

Commit 11c3d70

Browse files
authored
Fix environment variable mapping for read-only mode (#1067)
Fix environment variable mapping for read-only mode configuration Add SetEnvKeyReplacer to viper configuration to properly map environment variables with underscores to flag names with dashes. This enables the documented GITHUB_READ_ONLY=1 environment variable to work correctly. Without this fix, viper was looking for GITHUB_READ-ONLY (with dash) but the documentation and standard convention use GITHUB_READ_ONLY (with underscore). Fixes issue where read-only mode was not being activated when using GITHUB_READ_ONLY=1 in Docker containers.
1 parent 84ae009 commit 11c3d70

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cmd/github-mcp-server/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func init() {
100100
func initConfig() {
101101
// Initialize Viper configuration
102102
viper.SetEnvPrefix("github")
103+
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
103104
viper.AutomaticEnv()
104105

105106
}

0 commit comments

Comments
 (0)