File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows
118
118
### master (unreleased)
119
119
120
120
* Sleep only when we stop an host ([ #4 ] ( https://github.com/scaleway/docker-machine-driver-scaleway/issues/4 ) )
121
+ * Loads credentials from ` ~/.scwrc ` if available ([ #2 ] ( https://github.com/scaleway/docker-machine-driver-scaleway/issues/2 ) )
121
122
* Support of ` create `
122
123
* Support of ` start `
123
124
* Support of ` stop `
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
14
14
"github.com/docker/machine/libmachine/ssh"
15
15
"github.com/docker/machine/libmachine/state"
16
16
"github.com/scaleway/scaleway-cli/pkg/api"
17
+ "github.com/scaleway/scaleway-cli/pkg/config"
17
18
)
18
19
19
20
const (
@@ -57,7 +58,17 @@ func (d *Driver) getClient() (cl *api.ScalewayAPI, err error) {
57
58
func (d * Driver ) SetConfigFromFlags (flags drivers.DriverOptions ) (err error ) {
58
59
d .Token , d .Organization = flags .String ("scaleway-token" ), flags .String ("scaleway-organization" )
59
60
if d .Token == "" || d .Organization == "" {
60
- return fmt .Errorf ("You must provide organization and token" )
61
+ config , cfgErr := config .GetConfig ()
62
+ if cfgErr == nil {
63
+ if d .Token == "" {
64
+ d .Token = config .Token
65
+ }
66
+ if d .Organization == "" {
67
+ d .Organization = config .Organization
68
+ }
69
+ } else {
70
+ return fmt .Errorf ("You must provide organization and token" )
71
+ }
61
72
}
62
73
d .commercialType = flags .String ("scaleway-commercial-type" )
63
74
d .name = flags .String ("scaleway-name" )
You can’t perform that action at this time.
0 commit comments