From 22f9d7bafc60f56259e74df98e544b5820cfca5b Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 22 Mar 2022 14:42:20 +0100 Subject: Save a local copy of the disco list --- src/state.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/state.go') diff --git a/src/state.go b/src/state.go index 6f06860..ba485b2 100644 --- a/src/state.go +++ b/src/state.go @@ -7,13 +7,23 @@ type VPNState struct { // The chosen server Server *Server `json:"server"` + + // The list of servers and organizations from disco + DiscoList *DiscoList `json:"disco"` } func Register(state *VPNState, name string, directory string, stateCallback func(string, string, string)) error { state.Name = name state.ConfigDirectory = directory - stateCallback("START", "REGISTERED", "test data") + stateCallback("START", "REGISTERED", "app registered") + + // Try to load the previous configuration + + if state.LoadConfig() != nil { + // This error can be safely ignored, as when the config does not load, the struct will not be filled + // Make sure to log this when we have implemented a good logging system + } return nil } -- cgit v1.2.3