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 @@ -118,6 +118,7 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows
### master (unreleased)

* Sleep only when we stop an host ([#4](https://github.com/scaleway/docker-machine-driver-scaleway/issues/4))
* Loads credentials from `~/.scwrc` if available ([#2](https://github.com/scaleway/docker-machine-driver-scaleway/issues/2))
* Support of `create`
* Support of `start`
* Support of `stop`
Expand Down
13 changes: 12 additions & 1 deletion driver/scaleway.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/docker/machine/libmachine/ssh"
"github.com/docker/machine/libmachine/state"
"github.com/scaleway/scaleway-cli/pkg/api"
"github.com/scaleway/scaleway-cli/pkg/config"
)

const (
Expand Down Expand Up @@ -57,7 +58,17 @@ func (d *Driver) getClient() (cl *api.ScalewayAPI, err error) {
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) (err error) {
d.Token, d.Organization = flags.String("scaleway-token"), flags.String("scaleway-organization")
if d.Token == "" || d.Organization == "" {
return fmt.Errorf("You must provide organization and token")
config, cfgErr := config.GetConfig()
if cfgErr == nil {
if d.Token == "" {
d.Token = config.Token
}
if d.Organization == "" {
d.Organization = config.Organization
}
} else {
return fmt.Errorf("You must provide organization and token")
}
}
d.commercialType = flags.String("scaleway-commercial-type")
d.name = flags.String("scaleway-name")
Expand Down