Fix save config

This commit is contained in:
Owen Schwartz 2025-01-29 22:15:28 -05:00
parent 0c5c59cf00
commit f8dccbec80
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
2 changed files with 4 additions and 5 deletions

View file

@ -289,11 +289,6 @@ func main() {
loggerLevel := parseLogLevel(logLevel)
logger.GetLogger().SetLevel(parseLogLevel(logLevel))
// Validate required fields
if endpoint == "" || id == "" || secret == "" {
logger.Fatal("endpoint, id, and secret are required either via CLI flags or environment variables")
}
// parse the mtu string into an int
mtuInt, err = strconv.Atoi(mtu)
if err != nil {

View file

@ -305,6 +305,10 @@ func (c *Client) establishConnection() error {
go c.readPump()
if c.onConnect != nil {
err := c.saveConfig()
if err != nil {
logger.Error("Failed to save config: %v", err)
}
if err := c.onConnect(); err != nil {
logger.Error("OnConnect callback failed: %v", err)
}