Use loadCachedConfigs appropriately to load ENVs (#7187)

This commit is contained in:
Harshavardhana 2019-02-03 21:01:11 -08:00 committed by Nitish Tiwari
parent 6f08edfb36
commit ea6d61ab1f
2 changed files with 4 additions and 1 deletions

View file

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

View file

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