Skip to content

Commit 1d9edb9

Browse files
committed
Respect TLS configuration in registry browser login
1 parent e6b77ae commit 1d9edb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/buf/internal/command/registry/registrylogin/registrylogin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/bufbuild/buf/private/buf/bufapp"
2929
"github.com/bufbuild/buf/private/buf/bufcli"
3030
"github.com/bufbuild/buf/private/bufpkg/bufconnect"
31+
"github.com/bufbuild/buf/private/bufpkg/buftransport"
3132
"github.com/bufbuild/buf/private/gen/proto/connect/buf/alpha/registry/v1alpha1/registryv1alpha1connect"
3233
registryv1alpha1 "github.com/bufbuild/buf/private/gen/proto/go/buf/alpha/registry/v1alpha1"
3334
"github.com/bufbuild/buf/private/pkg/connectclient"
@@ -271,7 +272,6 @@ func doBrowserLogin(
271272
container appext.Container,
272273
remote string,
273274
) (string, error) {
274-
baseURL := "https://" + remote
275275
clientName, err := getClientName()
276276
if err != nil {
277277
return "", err
@@ -284,6 +284,10 @@ func doBrowserLogin(
284284
if err != nil {
285285
return "", err
286286
}
287+
baseURL := buftransport.PrependHTTPS(remote)
288+
if appConfig.TLS == nil {
289+
baseURL = buftransport.PrependHTTP(remote)
290+
}
287291
client := httpclient.NewClient(appConfig.TLS)
288292
oauth2Client := oauth2.NewClient(baseURL, client)
289293
// Register the device.

0 commit comments

Comments
 (0)