Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): retain config changes on re-login #2388

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions internal/cli/cmd/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,16 @@
refreshToken = ""
}

if err = libConfig.SaveCLIConfig(
libConfig.CLIConfig{
APIAddress: o.ServerAddress,
BearerToken: bearerToken,
RefreshToken: refreshToken,
InsecureSkipTLSVerify: o.InsecureTLS,
},
); err != nil {
if o.Config.APIAddress != o.ServerAddress {
o.Config = libConfig.CLIConfig{}

Check warning on line 181 in internal/cli/cmd/login/login.go

View check run for this annotation

Codecov / codecov/patch

internal/cli/cmd/login/login.go#L180-L181

Added lines #L180 - L181 were not covered by tests
}

o.Config.APIAddress = o.ServerAddress
o.Config.BearerToken = bearerToken
o.Config.RefreshToken = refreshToken
o.Config.InsecureSkipTLSVerify = o.InsecureTLS

Check warning on line 187 in internal/cli/cmd/login/login.go

View check run for this annotation

Codecov / codecov/patch

internal/cli/cmd/login/login.go#L184-L187

Added lines #L184 - L187 were not covered by tests

if err = libConfig.SaveCLIConfig(o.Config); err != nil {

Check warning on line 189 in internal/cli/cmd/login/login.go

View check run for this annotation

Codecov / codecov/patch

internal/cli/cmd/login/login.go#L189

Added line #L189 was not covered by tests
return fmt.Errorf("error persisting configuration: %w", err)
}
return nil
Expand Down
Loading