mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-11 15:44:52 +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"`
|
ServerBrokerEndpoint string `yaml:"serverbrokerendpoint"`
|
||||||
BrokerType string `yaml:"brokertype"`
|
BrokerType string `yaml:"brokertype"`
|
||||||
EmqxRestEndpoint string `yaml:"emqxrestendpoint"`
|
EmqxRestEndpoint string `yaml:"emqxrestendpoint"`
|
||||||
|
NetclientAutoUpdate string `yaml:"netclientautoupdate"`
|
||||||
MasterKey string `yaml:"masterkey"`
|
MasterKey string `yaml:"masterkey"`
|
||||||
DNSKey string `yaml:"dnskey"`
|
DNSKey string `yaml:"dnskey"`
|
||||||
AllowedOrigin string `yaml:"allowedorigin"`
|
AllowedOrigin string `yaml:"allowedorigin"`
|
||||||
|
|
|
@ -46,6 +46,11 @@ func GetServerConfig() config.ServerConfig {
|
||||||
cfg.StunPort = GetStunPort()
|
cfg.StunPort = GetStunPort()
|
||||||
cfg.BrokerType = GetBrokerType()
|
cfg.BrokerType = GetBrokerType()
|
||||||
cfg.EmqxRestEndpoint = GetEmqxRestEndpoint()
|
cfg.EmqxRestEndpoint = GetEmqxRestEndpoint()
|
||||||
|
if AutoUpdateEnabled() {
|
||||||
|
cfg.NetclientAutoUpdate = "enabled"
|
||||||
|
} else {
|
||||||
|
cfg.NetclientAutoUpdate = "disabled"
|
||||||
|
}
|
||||||
if IsRestBackend() {
|
if IsRestBackend() {
|
||||||
cfg.RestBackend = "on"
|
cfg.RestBackend = "on"
|
||||||
}
|
}
|
||||||
|
@ -385,7 +390,12 @@ func GetVerbosity() int32 {
|
||||||
// AutoUpdateEnabled returns a boolean indicating whether netclient auto update is enabled or disabled
|
// AutoUpdateEnabled returns a boolean indicating whether netclient auto update is enabled or disabled
|
||||||
// default is enabled
|
// default is enabled
|
||||||
func AutoUpdateEnabled() bool {
|
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
|
// IsDNSMode - should it run with DNS
|
||||||
|
|
Loading…
Add table
Reference in a new issue