gateway: Properly set globalMinioPort (#6859)

globalMinioPort is used in federation which stores the address
and the port number of the server hosting the specified bucket,
this latter uses globalMinioPort but this latter is not set in
startup of the gateway mode.

This commit fixes the behavior.
This commit is contained in:
Anis Elleuch 2018-11-26 18:49:38 +01:00 committed by Nitish Tiwari
parent 2a810c7da2
commit dd092f6c2b
1 changed files with 3 additions and 2 deletions

View File

@ -135,7 +135,8 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
handleCommonCmdArgs(ctx) handleCommonCmdArgs(ctx)
// Get port to listen on from gateway address // Get port to listen on from gateway address
_, gatewayPort, pErr := net.SplitHostPort(gatewayAddr) var pErr error
_, globalMinioPort, pErr = net.SplitHostPort(gatewayAddr)
if pErr != nil { if pErr != nil {
logger.FatalIf(pErr, "Unable to start gateway") logger.FatalIf(pErr, "Unable to start gateway")
} }
@ -144,7 +145,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// to IPv6 address ie minio will start listening on IPv6 address whereas another // to IPv6 address ie minio will start listening on IPv6 address whereas another
// (non-)minio process is listening on IPv4 of given port. // (non-)minio process is listening on IPv4 of given port.
// To avoid this error situation we check for port availability. // To avoid this error situation we check for port availability.
logger.FatalIf(checkPortAvailability(gatewayPort), "Unable to start the gateway") logger.FatalIf(checkPortAvailability(globalMinioPort), "Unable to start the gateway")
// Create certs path. // Create certs path.
logger.FatalIf(createConfigDir(), "Unable to create configuration directories") logger.FatalIf(createConfigDir(), "Unable to create configuration directories")