mirror of
https://github.com/fosrl/olm.git
synced 2026-03-06 18:56:44 +00:00
Handle config saving more gracefully
This commit is contained in:
@@ -27,6 +27,10 @@ func getConfigPath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) loadConfig() error {
|
func (c *Client) loadConfig() error {
|
||||||
|
if c.config.NewtID != "" && c.config.Secret != "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
configPath := getConfigPath()
|
configPath := getConfigPath()
|
||||||
data, err := os.ReadFile(configPath)
|
data, err := os.ReadFile(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -41,8 +45,9 @@ func (c *Client) loadConfig() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only update token from saved config
|
c.config.Token = config.Token // I think it always needs to get a new token
|
||||||
c.config.Token = config.Token
|
c.config.NewtID = config.NewtID
|
||||||
|
c.config.Secret = config.Secret
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user