From 94a94613ebead3da5510a98e74a936afcc70e3cd Mon Sep 17 00:00:00 2001 From: Owen Schwartz Date: Sat, 23 Nov 2024 16:27:40 -0500 Subject: [PATCH] Handle config saving more gracefully --- websocket/config.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/websocket/config.go b/websocket/config.go index efc6e22..ae5efa5 100644 --- a/websocket/config.go +++ b/websocket/config.go @@ -27,6 +27,10 @@ func getConfigPath() string { } func (c *Client) loadConfig() error { + if c.config.NewtID != "" && c.config.Secret != "" { + return nil + } + configPath := getConfigPath() data, err := os.ReadFile(configPath) if err != nil { @@ -41,8 +45,9 @@ func (c *Client) loadConfig() error { return err } - // Only update token from saved config - c.config.Token = config.Token + c.config.Token = config.Token // I think it always needs to get a new token + c.config.NewtID = config.NewtID + c.config.Secret = config.Secret return nil }