diff --git a/config/config.go b/config/config.go index 89979410..9c3e45fa 100644 --- a/config/config.go +++ b/config/config.go @@ -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"` diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index ea68ca88..bd2d093c 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -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