diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-22 12:16:54 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-09-25 09:43:37 +0200 |
| commit | eb57e36d3c017bef80277e97db1009c38893ce2d (patch) | |
| tree | 11ae9fa5e75492690e3db4bde349e2accc3fa1c9 /cmd/cli | |
| parent | f5fe3d75801830ab9f1d380f5b3238b9006cf48b (diff) | |
Exports + Client: Refactor registering a client
- Make sure the global exports state is only set on successful
creating
- Only call discovery when adding a server to ensure we get the most
up to date args. Creating a client should have no network calls. Fixes #12
- Split creating a client in New and Register in the GO api
Diffstat (limited to 'cmd/cli')
| -rw-r--r-- | cmd/cli/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 9ff880d..ff99a15 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -173,9 +173,8 @@ func getConfig(state *client.Client, url string, srvType ServerTypes) (*srvtypes // Get a config for a single server, Institute Access or Secure Internet. func printConfig(url string, srvType ServerTypes) { - c := &client.Client{} - - err := c.Register( + var c *client.Client + c, err := client.New( "org.eduvpn.app.linux", "1.1.2-cli", "configs", @@ -189,6 +188,7 @@ func printConfig(url string, srvType ServerTypes) { fmt.Printf("Register error: %v", err) return } + _ = c.Register() defer c.Deregister() |
