mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 03:28:19 +01:00
feat(cloud): disconnect from cloud immediately when cloud URL changes or user requests to deregister
This commit is contained in:
@@ -771,9 +771,14 @@ func rpcSetUsbDeviceState(device string, enabled bool) error {
|
||||
}
|
||||
|
||||
func rpcSetCloudUrl(apiUrl string, appUrl string) error {
|
||||
currentCloudURL := config.CloudURL
|
||||
config.CloudURL = apiUrl
|
||||
config.CloudAppURL = appUrl
|
||||
|
||||
if currentCloudURL != apiUrl {
|
||||
disconnectCloud(fmt.Errorf("cloud url changed from %s to %s", currentCloudURL, apiUrl))
|
||||
}
|
||||
|
||||
if err := SaveConfig(); err != nil {
|
||||
return fmt.Errorf("failed to save config: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user