Skip to content

Commit

Permalink
Stop appending :443 to the server address when using grpc-web (argopr…
Browse files Browse the repository at this point in the history
…oj#15435)

Signed-off-by: David Marby <david@dmarby.se>
Co-authored-by: jannfis <jann@mistrust.net>
  • Loading branch information
DMarby and jannfis authored Sep 12, 2023
1 parent 43c5905 commit 339072f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/apiclient/apiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ func NewClient(opts *ClientOptions) (Client, error) {
if c.ServerAddr == "" {
return nil, errors.New("Argo CD server address unspecified")
}
if parts := strings.Split(c.ServerAddr, ":"); len(parts) == 1 {
// If port is unspecified, assume the most likely port
c.ServerAddr += ":443"
}
// Override auth-token if specified in env variable or CLI flag
c.AuthToken = env.StringFromEnv(EnvArgoCDAuthToken, c.AuthToken)
if opts.AuthToken != "" {
Expand Down Expand Up @@ -285,6 +281,10 @@ func NewClient(opts *ClientOptions) (Client, error) {
}
}
if !c.GRPCWeb {
if parts := strings.Split(c.ServerAddr, ":"); len(parts) == 1 {
// If port is unspecified, assume the most likely port
c.ServerAddr += ":443"
}
// test if we need to set it to true
// if a call to grpc failed, then try again with GRPCWeb
conn, versionIf, err := c.NewVersionClient()
Expand Down

0 comments on commit 339072f

Please sign in to comment.