Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address'

#### Features

* `scw -D login` displays a fake password
* Syncing cache to disk after server creation when running `scw run` in a non-detached mode
* Bump to Golang 1.5
* Support --tmp-ssh-key `scw {run,create}` option ([#99](https://github.com/scaleway/scaleway-cli/issues/99))
Expand Down
12 changes: 12 additions & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type ScalewayAPI struct {
// Token is the authentication token for the Scaleway organization
Token string

// Password is the authentication password
password string

// Cache is used to quickly resolve identifiers from names
Cache *ScalewayCache

Expand Down Expand Up @@ -595,6 +598,7 @@ func NewScalewayAPI(apiEndPoint, accountEndPoint, organization, token string) (*
Organization: organization,
Token: token,
Cache: cache,
password: "",

// internal
anonuuid: *anonuuid.New(),
Expand Down Expand Up @@ -1459,6 +1463,9 @@ func (s *ScalewayAPI) HideAPICredentials(input string) string {
if s.Organization != "" {
output = strings.Replace(output, s.Organization, s.anonuuid.FakeUUID(s.Organization), -1)
}
if s.password != "" {
output = strings.Replace(output, s.password, "XX-XX-XX-XX", -1)
}
return output
}

Expand All @@ -1471,3 +1478,8 @@ func (s *ScalewayAPI) EnableAccountAPI() {
func (s *ScalewayAPI) DisableAccountAPI() {
s.APIUrl = s.ComputeAPI
}

// SetPassword register the password
func (s *ScalewayAPI) SetPassword(password string) {
s.password = password
}
1 change: 1 addition & 0 deletions pkg/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func getToken(connect api.ScalewayConnect) (string, error) {
return "", fmt.Errorf("Unable to create a fake ScalewayAPI: %s", err)
}
FakeConnection.EnableAccountAPI()
FakeConnection.SetPassword(connect.Password)

resp, err := FakeConnection.PostResponse("tokens", connect)
if err != nil {
Expand Down