mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 13:14:24 +08:00
add auto update config to server yaml
This commit is contained in:
parent
1032eb86c5
commit
96d7b67822
2 changed files with 12 additions and 1 deletions
|
@ -40,6 +40,7 @@ type ServerConfig struct {
|
|||
ServerBrokerEndpoint string `yaml:"serverbrokerendpoint"`
|
||||
BrokerType string `yaml:"brokertype"`
|
||||
EmqxRestEndpoint string `yaml:"emqxrestendpoint"`
|
||||
NetclientAutoUpdate string `yaml:"netclientautoupdate"`
|
||||
MasterKey string `yaml:"masterkey"`
|
||||
DNSKey string `yaml:"dnskey"`
|
||||
AllowedOrigin string `yaml:"allowedorigin"`
|
||||
|
|
|
@ -46,6 +46,11 @@ func GetServerConfig() config.ServerConfig {
|
|||
cfg.StunPort = GetStunPort()
|
||||
cfg.BrokerType = GetBrokerType()
|
||||
cfg.EmqxRestEndpoint = GetEmqxRestEndpoint()
|
||||
if AutoUpdateEnabled() {
|
||||
cfg.NetclientAutoUpdate = "enabled"
|
||||
} else {
|
||||
cfg.NetclientAutoUpdate = "disabled"
|
||||
}
|
||||
if IsRestBackend() {
|
||||
cfg.RestBackend = "on"
|
||||
}
|
||||
|
@ -385,7 +390,12 @@ func GetVerbosity() int32 {
|
|||
// AutoUpdateEnabled returns a boolean indicating whether netclient auto update is enabled or disabled
|
||||
// default is enabled
|
||||
func AutoUpdateEnabled() bool {
|
||||
return os.Getenv("NETCLIENT_AUTO_UPDATE") != "disabled"
|
||||
if os.Getenv("NETCLIENT_AUTO_UPDATE") == "disabled" {
|
||||
return false
|
||||
} else if config.Config.Server.NetclientAutoUpdate == "disabled" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// IsDNSMode - should it run with DNS
|
||||
|
|
Loading…
Add table
Reference in a new issue