mirror of
https://github.com/fosrl/newt.git
synced 2025-05-13 05:30:39 +01:00
Fix save config
This commit is contained in:
parent
0c5c59cf00
commit
f8dccbec80
2 changed files with 4 additions and 5 deletions
5
main.go
5
main.go
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue