Fix various things

This commit is contained in:
Owen Schwartz
2024-12-07 22:07:02 -05:00
parent 6eac4b5147
commit 31692c03e8
4 changed files with 96 additions and 31 deletions

View File

@@ -27,7 +27,7 @@ func getConfigPath() string {
}
func (c *Client) loadConfig() error {
if c.config.NewtID != "" && c.config.Secret != "" {
if c.config.NewtID != "" && c.config.Secret != "" && c.config.Endpoint != "" {
return nil
}
@@ -45,9 +45,20 @@ func (c *Client) loadConfig() error {
return err
}
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
if c.config.NewtID == "" {
c.config.NewtID = config.NewtID
}
if c.config.Token == "" {
c.config.Token = config.Token
}
if c.config.Secret == "" {
c.config.Secret = config.Secret
}
if c.config.Endpoint == "" {
c.config.Endpoint = config.Endpoint
c.baseURL = config.Endpoint
}
return nil
}