Set Deployment ID before starting handlers (#9635)

Global handler ID is added to response headers, so initialize it before the server starts.

Fixes #9634
This commit is contained in:
Klaus Post 2020-05-18 20:35:05 +02:00 committed by GitHub
parent 1bc32215b9
commit 1847f17f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,10 @@ func ValidateGatewayArguments(serverAddr, endpointAddr string) error {
// StartGateway - handler for 'minio gateway <name>'. // StartGateway - handler for 'minio gateway <name>'.
func StartGateway(ctx *cli.Context, gw Gateway) { func StartGateway(ctx *cli.Context, gw Gateway) {
// This is only to uniquely identify each gateway deployments.
globalDeploymentID = env.Get("MINIO_GATEWAY_DEPLOYMENT_ID", mustGetUUID())
logger.SetDeploymentID(globalDeploymentID)
if gw == nil { if gw == nil {
logger.FatalIf(errUnexpected, "Gateway implementation not initialized") logger.FatalIf(errUnexpected, "Gateway implementation not initialized")
} }
@ -260,9 +264,6 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// is only enabled for "NAS" gateway. // is only enabled for "NAS" gateway.
globalConfigSys.WatchConfigNASDisk(GlobalContext, newObject) globalConfigSys.WatchConfigNASDisk(GlobalContext, newObject)
} }
// This is only to uniquely identify each gateway deployments.
globalDeploymentID = env.Get("MINIO_GATEWAY_DEPLOYMENT_ID", mustGetUUID())
logger.SetDeploymentID(globalDeploymentID)
if globalEtcdClient != nil { if globalEtcdClient != nil {
// **** WARNING **** // **** WARNING ****