mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 03:28:19 +01:00
fix(cloud): only start WS Client if config.CloudToken is set (#27)
This commit is contained in:
5
cloud.go
5
cloud.go
@@ -68,6 +68,11 @@ func handleCloudRegister(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.CloudToken == "" {
|
||||||
|
logger.Info("Starting websocket client due to adoption")
|
||||||
|
go RunWebsocketClient()
|
||||||
|
}
|
||||||
|
|
||||||
config.CloudToken = tokenResp.SecretToken
|
config.CloudToken = tokenResp.SecretToken
|
||||||
config.CloudURL = req.CloudAPI
|
config.CloudURL = req.CloudAPI
|
||||||
|
|
||||||
|
|||||||
6
main.go
6
main.go
@@ -66,7 +66,11 @@ func Main() {
|
|||||||
}()
|
}()
|
||||||
//go RunFuseServer()
|
//go RunFuseServer()
|
||||||
go RunWebServer()
|
go RunWebServer()
|
||||||
go RunWebsocketClient()
|
// If the cloud token isn't set, the client won't be started by default.
|
||||||
|
// However, if the user adopts the device via the web interface, handleCloudRegister will start the client.
|
||||||
|
if config.CloudToken != "" {
|
||||||
|
go RunWebsocketClient()
|
||||||
|
}
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-sigs
|
<-sigs
|
||||||
|
|||||||
Reference in New Issue
Block a user