Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func handleCloudRegister(c *gin.Context) {
return
}

if config.CloudToken == "" {
logger.Info("Starting websocket client due to adoption")
go RunWebsocketClient()
}

config.CloudToken = tokenResp.SecretToken
config.CloudURL = req.CloudAPI

Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ func Main() {
}()
//go RunFuseServer()
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)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
<-sigs
Expand Down