Restore instance loaded from configuration
authorMikael Berthe <mikael@lilotux.net>
Wed, 12 Apr 2017 22:31:21 +0200
changeset 90 686374268c54
parent 89 8a7a33bec6e1
child 91 ae9ad3c7bca5
Restore instance loaded from configuration
cmd/gondole-cli/main.go
--- a/cmd/gondole-cli/main.go	Wed Apr 12 22:26:52 2017 +0200
+++ b/cmd/gondole-cli/main.go	Wed Apr 12 22:31:21 2017 +0200
@@ -76,7 +76,15 @@
 
 	// Load configuration, will register if none is found
 	cnf, err = LoadConfig(instanceName)
-	if err != nil {
+	if err == nil && cnf != nil {
+		instance = &gondole.Client{
+			ID:          cnf.ID,
+			InstanceURL: cnf.InstanceURL,
+			APIBase:     cnf.APIBase,
+			Name:        cnf.Name,
+			Secret:      cnf.BearerToken,
+		}
+	} else {
 		// Nothing exist yet
 		/*
 			defName := Config{