File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed 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