Use loadCachedConfigs appropriately to load ENVs (#7187)

master
Harshavardhana 6 years ago committed by Nitish Tiwari
parent 6f08edfb36
commit ea6d61ab1f
  1. 2
      cmd/config-current.go
  2. 3
      cmd/gateway-main.go

@ -282,7 +282,7 @@ func (s *serverConfig) loadFromEnvs() {
if jwksURL, ok := os.LookupEnv("MINIO_IAM_JWKS_URL"); ok { if jwksURL, ok := os.LookupEnv("MINIO_IAM_JWKS_URL"); ok {
if u, err := xnet.ParseURL(jwksURL); err == nil { if u, err := xnet.ParseURL(jwksURL); err == nil {
s.OpenID.JWKS.URL = u s.OpenID.JWKS.URL = u
s.OpenID.JWKS.PopulatePublicKey() logger.FatalIf(s.OpenID.JWKS.PopulatePublicKey(), "Unable to populate public key from JWKS URL")
} }
} }

@ -203,6 +203,9 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Override any values from ENVs. // Override any values from ENVs.
srvCfg.loadFromEnvs() srvCfg.loadFromEnvs()
// Load values to cached global values.
srvCfg.loadToCachedConfigs()
// hold the mutex lock before a new config is assigned. // hold the mutex lock before a new config is assigned.
globalServerConfigMu.Lock() globalServerConfigMu.Lock()
globalServerConfig = srvCfg globalServerConfig = srvCfg

Loading…
Cancel
Save