Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3781a2

Browse files
take env var and use the With rather than assignment
1 parenteb6c7f5 commitb3781a2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎cmd/github-mcp-server/main.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ func runStdioServer(readOnly bool, logger *log.Logger, logCommands bool, exportT
102102
logger.Fatal("GITHUB_PERSONAL_ACCESS_TOKEN not set")
103103
}
104104
ghClient:=gogithub.NewClient(nil).WithAuthToken(token)
105-
ifhost:=viper.GetString("gh-host");host!="" {
105+
106+
// Check GH_HOST env var first, then fall back to viper config
107+
host:=os.Getenv("GH_HOST")
108+
ifhost=="" {
109+
host=viper.GetString("gh-host")
110+
}
111+
112+
ifhost!="" {
106113
parsedURL,err:=url.Parse(fmt.Sprintf("https://api.%s/",host))
107114
iferr!=nil {
108115
returnfmt.Errorf("failed to parse provided GitHub host URL: %w",err)
@@ -113,8 +120,10 @@ func runStdioServer(readOnly bool, logger *log.Logger, logCommands bool, exportT
113120
returnfmt.Errorf("failed to parse provided GitHub host URL: %w",err)
114121
}
115122

116-
ghClient.BaseURL=parsedURL
117-
ghClient.UploadURL=uploadURL
123+
ghClient,err=ghClient.WithEnterpriseURLs(parsedURL.String(),uploadURL.String())
124+
iferr!=nil {
125+
returnfmt.Errorf("failed to create GitHub client with host: %w",err)
126+
}
118127
}
119128

120129
t,dumpTranslations:=translations.TranslationHelper()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp