default proxy mode

This commit is contained in:
Matthew R Kasun
2023-03-13 14:39:13 -04:00
parent bcbe355281
commit b3cfbe7266
8 changed files with 91 additions and 42 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"github.com/google/uuid"
"github.com/gravitl/netmaker/database"
@@ -96,6 +97,15 @@ func CreateHost(h *models.Host) error {
return err
}
h.HostPass = string(hash)
// if another server has already updated proxyenabled, leave it alone
if !h.ProxyEnabledSet {
log.Println("checking default proxy", servercfg.GetServerConfig().DefaultProxyMode)
if servercfg.GetServerConfig().DefaultProxyMode.Set {
h.ProxyEnabledSet = true
h.ProxyEnabled = servercfg.GetServerConfig().DefaultProxyMode.Value
log.Println("set proxy enabled to ", h.ProxyEnabled)
}
}
checkForZombieHosts(h)
return UpsertHost(h)
}