Skip to content

Commit

Permalink
Accept ACS token passed in env to auth login
Browse files Browse the repository at this point in the history
dcos cluster setup accepts ACS Toekn set in DCOS_CLUSTER_SETUP_ACS_TOKEN
environment variable. This PR will add the same behaviour to auth login.

Fixes: https://jira.d2iq.com/browse/COPS-6421
  • Loading branch information
janisz committed Aug 14, 2020
1 parent 59b3d98 commit 110b848
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/cmd/auth/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ func newCmdAuthLogin(ctx api.Context) *cobra.Command {
if err != nil {
return err
}
acsToken, err := ctx.Login(flags, httpClient)
if err != nil {
return err
// Login to get the ACS token, unless it is already present as an env var.
acsToken, _ := ctx.EnvLookup("DCOS_CLUSTER_SETUP_ACS_TOKEN")
if acsToken == "" {
acsToken, err = ctx.Login(flags, httpClient)
if err != nil {
return err
}
}
cluster.SetACSToken(acsToken)
err = cluster.Config().Persist()
Expand Down

0 comments on commit 110b848

Please sign in to comment.