diff --git a/logic/settings.go b/logic/settings.go index 632e5c39..b889b6e0 100644 --- a/logic/settings.go +++ b/logic/settings.go @@ -33,6 +33,11 @@ func UpsertServerSettings(s models.ServerSettings) error { if s.ClientSecret == Mask() { s.ClientSecret = currSettings.ClientSecret } + + if servercfg.DeployedByOperator() { + s.BasicAuth = true + } + data, err := json.Marshal(s) if err != nil { return err @@ -317,6 +322,10 @@ func GetManageDNS() bool { // IsBasicAuthEnabled - checks if basic auth has been configured to be turned off func IsBasicAuthEnabled() bool { + if servercfg.DeployedByOperator() { + return true + } + return GetServerSettings().BasicAuth } diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index ab78cbb9..b4f887a2 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -721,6 +721,10 @@ func GetEmqxRestEndpoint() string { // IsBasicAuthEnabled - checks if basic auth has been configured to be turned off func IsBasicAuthEnabled() bool { + if DeployedByOperator() { + return true + } + var enabled = true //default if os.Getenv("BASIC_AUTH") != "" { enabled = os.Getenv("BASIC_AUTH") == "yes"