mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-08 14:15:25 +08:00
NET-641: Enable/Disable Auto Update From UI (#2622)
* add support to disable/enable autoupdate on a host * setting to older version for QA to test
This commit is contained in:
parent
64d2a4820c
commit
675c4ec34c
3 changed files with 4 additions and 1 deletions
|
@ -199,7 +199,6 @@ func UpdateHost(newHost, currentHost *models.Host) {
|
|||
newHost.Nodes = currentHost.Nodes
|
||||
newHost.PublicKey = currentHost.PublicKey
|
||||
newHost.TrafficKeyPublic = currentHost.TrafficKeyPublic
|
||||
|
||||
// changeable fields
|
||||
if len(newHost.Version) == 0 {
|
||||
newHost.Version = currentHost.Version
|
||||
|
|
1
main.go
1
main.go
|
@ -28,6 +28,7 @@ import (
|
|||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
|
||||
var version = "v0.21.2"
|
||||
|
||||
// Start DB Connection and start API Request Handler
|
||||
|
|
|
@ -32,6 +32,7 @@ type ApiHost struct {
|
|||
RelayedHosts []string `json:"relay_hosts" yaml:"relay_hosts" bson:"relay_hosts"`
|
||||
NatType string `json:"nat_type" yaml:"nat_type"`
|
||||
PersistentKeepalive int `json:"persistentkeepalive" yaml:"persistentkeepalive"`
|
||||
AutoUpdate bool `json:"autoupdate" yaml:"autoupdate"`
|
||||
}
|
||||
|
||||
// Host.ConvertNMHostToAPI - converts a Netmaker host to an API editable host
|
||||
|
@ -60,6 +61,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost {
|
|||
a.IsDefault = h.IsDefault
|
||||
a.NatType = h.NatType
|
||||
a.PersistentKeepalive = int(h.PersistentKeepalive.Seconds())
|
||||
a.AutoUpdate = h.AutoUpdate
|
||||
return &a
|
||||
}
|
||||
|
||||
|
@ -98,5 +100,6 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
|
|||
h.NatType = currentHost.NatType
|
||||
h.TurnEndpoint = currentHost.TurnEndpoint
|
||||
h.PersistentKeepalive = time.Duration(a.PersistentKeepalive) * time.Second
|
||||
h.AutoUpdate = a.AutoUpdate
|
||||
return &h
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue