func (s *State) Load() { if data, err := ioutil.ReadFile(s.getConfigPath()); err == nil { if err = json.Unmarshal(data, s); err == nil { log.Info("state restored, %+v", s) } } }
func actionGetIP(ctx *cli.Context) { if NetworkKey == "" { log.Fatal(keyNotSetError.Error()) } secret, err := secure.NetworkSecretUnmarshal(NetworkKey) if err != nil { log.Fatal("error on decode network key, %v", err) } state := common.NewState(secret) state.Save() fmt.Println(state.PrivateIP.String()) log.Info("private IP %q restored successfully", state.PrivateIP.String()) }