mirror of
https://github.com/minio/minio.git
synced 2025-01-23 12:43:16 -05:00
Make sure env are loaded before gateway layer initialization (#6989)
This commit is contained in:
parent
3be616de3f
commit
7da0336ac8
@ -215,6 +215,22 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
|
|
||||||
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
|
// !!! Do not move this block !!!
|
||||||
|
// For all gateways, the config needs to be loaded from env
|
||||||
|
// prior to initializing the gateway layer
|
||||||
|
{
|
||||||
|
// Initialize server config.
|
||||||
|
srvCfg := newServerConfig()
|
||||||
|
|
||||||
|
// Override any values from ENVs.
|
||||||
|
srvCfg.loadFromEnvs()
|
||||||
|
|
||||||
|
// hold the mutex lock before a new config is assigned.
|
||||||
|
globalServerConfigMu.Lock()
|
||||||
|
globalServerConfig = srvCfg
|
||||||
|
globalServerConfigMu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
newObject, err := gw.NewGatewayLayer(globalServerConfig.GetCredential())
|
newObject, err := gw.NewGatewayLayer(globalServerConfig.GetCredential())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Stop watching for any certificate changes.
|
// Stop watching for any certificate changes.
|
||||||
@ -223,27 +239,14 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
globalHTTPServer.Shutdown()
|
globalHTTPServer.Shutdown()
|
||||||
logger.FatalIf(err, "Unable to initialize gateway backend")
|
logger.FatalIf(err, "Unable to initialize gateway backend")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if globalEtcdClient != nil && gatewayName == "nas" {
|
||||||
// Create a new config system.
|
// Create a new config system.
|
||||||
globalConfigSys = NewConfigSys()
|
globalConfigSys = NewConfigSys()
|
||||||
if globalEtcdClient != nil && gatewayName == "nas" {
|
|
||||||
// Initialize server config.
|
// Load globalServerConfig from etcd
|
||||||
_ = globalConfigSys.Init(newObject)
|
_ = globalConfigSys.Init(newObject)
|
||||||
} else {
|
|
||||||
// Initialize server config.
|
|
||||||
srvCfg := newServerConfig()
|
|
||||||
|
|
||||||
// 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
|
|
||||||
globalServerConfigMu.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load logger subsystem
|
// Load logger subsystem
|
||||||
loadLoggers()
|
loadLoggers()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user