Skip to content

Commit d04aceb

Browse files
committed
Respect GH_HOST unless --github-host was given
1 parent 6d0d8df commit d04aceb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webhook/forward.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ func NewCmdForward() *cobra.Command {
3636
$ gh webhook forward --events=issues --repo=monalisa/smile --url="http://localhost:9999/webhooks"
3737
$ gh webhook forward --events=issues --org=github --url="http://localhost:9999/webhooks"
3838
`),
39-
RunE: func(*cobra.Command, []string) error {
39+
RunE: func(c *cobra.Command, _ []string) error {
4040
if targetRepo == "" && targetOrg == "" {
4141
return errors.New("`--repo` or `--org` flag required")
4242
}
4343

44+
if envHost := os.Getenv("GH_HOST"); envHost != "" && !c.Flags().Changed("github-host") {
45+
githubHost = envHost
46+
}
47+
4448
authToken, err := authTokenForHost(githubHost)
4549
if err != nil {
4650
return fmt.Errorf("fatal: error fetching gh token: %w", err)

0 commit comments

Comments
 (0)