Skip to content

Commit 51ba26f

Browse files
committed
Enable login via env vars (for CI)
Signed-off-by: Sean P. Kane <sean@superorbital.io>
1 parent c9cb0ac commit 51ba26f

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

internal/login/login.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,21 @@ import (
3939
// RunLogin logs the user and asks for the 2FA code if needed
4040
func RunLogin(ctx context.Context, streams command.Streams, hubClient *hub.Client, store credentials.Store, candidateUsername string) error {
4141
username := candidateUsername
42+
if username == "" {
43+
username = os.Getenv("DOCKER_USERNAME")
44+
}
4245
if username == "" {
4346
var err error
4447
if username, err = readClearText(ctx, streams, "Username: "); err != nil {
4548
return err
4649
}
4750
}
48-
password, err := readPassword(streams)
49-
if err != nil {
50-
return err
51+
password := os.Getenv("DOCKER_PASSWORD")
52+
if password == "" {
53+
var err error
54+
if password, err = readPassword(streams); err != nil {
55+
return err
56+
}
5157
}
5258

5359
token, refreshToken, err := Login(ctx, streams, hubClient, username, password)

0 commit comments

Comments
 (0)