diff --git a/internal/route/route.go b/internal/route/route.go index ceb2bf03..9277dd29 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -183,11 +183,17 @@ func (r *Route) validate() gperr.Error { }, r.started) if r.Proxmox != nil && r.Idlewatcher != nil { - r.Idlewatcher.Proxmox = r.Proxmox + r.Idlewatcher.Proxmox = &types.ProxmoxConfig{ + Node: r.Proxmox.Node, + VMID: r.Proxmox.VMID, + } } if r.Proxmox == nil && r.Idlewatcher != nil && r.Idlewatcher.Proxmox != nil { - r.Proxmox = r.Idlewatcher.Proxmox + r.Proxmox = &proxmox.NodeConfig{ + Node: r.Idlewatcher.Proxmox.Node, + VMID: r.Idlewatcher.Proxmox.VMID, + } } if r.Proxmox != nil { diff --git a/internal/types/idlewatcher.go b/internal/types/idlewatcher.go index 9e01d1a1..a83d1449 100644 --- a/internal/types/idlewatcher.go +++ b/internal/types/idlewatcher.go @@ -6,14 +6,13 @@ import ( "strings" "time" - "github.com/yusing/godoxy/internal/proxmox" gperr "github.com/yusing/goutils/errs" ) type ( IdlewatcherProviderConfig struct { - Proxmox *proxmox.NodeConfig `json:"proxmox,omitempty"` - Docker *DockerConfig `json:"docker,omitempty"` + Proxmox *ProxmoxConfig `json:"proxmox,omitempty"` + Docker *DockerConfig `json:"docker,omitempty"` } // @name IdlewatcherProviderConfig IdlewatcherConfigBase struct { // 0: no idle watcher. @@ -43,6 +42,10 @@ type ( ContainerID string `json:"container_id" validate:"required"` ContainerName string `json:"container_name" validate:"required"` } // @name DockerConfig + ProxmoxConfig struct { + Node string `json:"node" validate:"required"` + VMID int `json:"vmid" validate:"required"` + } // @name ProxmoxNodeConfig ) const (