diff options
| author | Jeroen Wijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-21 17:16:28 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-21 17:16:28 +0100 |
| commit | 324202a50e440cac36a756d6a2628ebadd2f8d70 (patch) | |
| tree | 10381dc1e490eddb3b446a8f3ce599493f87d26d /cli/main.go | |
| parent | fc56f8770923ec1997444a8318a18be0a8397520 (diff) | |
Update python and add basic config support
Diffstat (limited to 'cli/main.go')
| -rw-r--r-- | cli/main.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cli/main.go b/cli/main.go index 3c66804..d5b51e8 100644 --- a/cli/main.go +++ b/cli/main.go @@ -14,8 +14,8 @@ func openBrowser(urlString string) { exec.Command("xdg-open", urlString).Start() } -func logState(oldState string, newState string) { - log.Printf("State: %s -> State: %s\n", oldState, newState) +func logState(oldState string, newState string, data string) { + log.Printf("State: %s -> State: %s with data %s\n", oldState, newState, data) } func main() { @@ -34,21 +34,28 @@ func main() { state := eduvpn.GetVPNState() - eduvpn.Register(state, "org.eduvpn.app.linux", logState) + eduvpn.Register(state, "org.eduvpn.app.linux", "configs", logState) state.Server = &eduvpn.Server{} serverInitializeErr := state.Server.Initialize(urlString) if serverInitializeErr != nil { log.Fatal(serverInitializeErr) } - authURL, err := state.InitializeOAuth() - if err != nil { - log.Fatal(err) + if state.LoadConfig() != nil { + authURL, err := state.InitializeOAuth() + if err != nil { + log.Fatal(err) + } + openBrowser(authURL) + oauthErr := state.FinishOAuth() + if oauthErr != nil { + log.Fatal(oauthErr) + } } - openBrowser(authURL) - oauthErr := state.FinishOAuth() - if oauthErr != nil { - log.Fatal(oauthErr) + + writeErr := state.WriteConfig() + if writeErr != nil { + log.Fatal(writeErr) } wireguardKey, wireguardErr := eduvpn.WireguardGenerateKey() |
