Skip to content

Commit

Permalink
Fix login
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Dec 31, 2024
1 parent 99107be commit d26e49a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/crproxy/cluster/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func runE(ctx context.Context, flags *flagpole) error {
}

transportOpts := []transport.Option{
transport.WithUserAndPass(flags.Userpass),
transport.WithLogger(logger),
}

Expand Down
1 change: 1 addition & 0 deletions cmd/crproxy/cluster/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func runE(ctx context.Context, flags *flagpole) error {
}

transportOpts := []transport.Option{
transport.WithUserAndPass(flags.Userpass),
transport.WithLogger(logger),
}

Expand Down
7 changes: 5 additions & 2 deletions transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ func NewTransport(opts ...Option) (http.RoundTripper, error) {
}

for _, opt := range opts {
opt(c)
err := opt(c)
if err != nil {
return nil, err
}
}

return c, nil
Expand Down Expand Up @@ -169,7 +172,7 @@ func toUserAndPass(userpass []string) (map[string]authn.AuthConfig, error) {
}

u := strings.SplitN(s[0], ":", 3)
if len(s) != 2 {
if len(u) != 2 {
return nil, fmt.Errorf("invalid userpass %q", up)
}
host := s[1]
Expand Down

0 comments on commit d26e49a

Please sign in to comment.