mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Gateway should honour --address flag while checking port availability (#6428)
Fixes #6426
This commit is contained in:
parent
fd8749f42a
commit
9e5c4df106
@ -19,6 +19,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -136,11 +137,17 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
// Handle common env vars.
|
// Handle common env vars.
|
||||||
handleCommonEnvVars()
|
handleCommonEnvVars()
|
||||||
|
|
||||||
|
// Get port to listen on from gateway address
|
||||||
|
_, gatewayPort, pErr := net.SplitHostPort(gatewayAddr)
|
||||||
|
if pErr != nil {
|
||||||
|
logger.FatalIf(pErr, "Unable to start gateway")
|
||||||
|
}
|
||||||
|
|
||||||
// On macOS, if a process already listens on LOCALIPADDR:PORT, net.Listen() falls back
|
// On macOS, if a process already listens on LOCALIPADDR:PORT, net.Listen() falls back
|
||||||
// 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(globalMinioPort), "Unable to start the server")
|
logger.FatalIf(checkPortAvailability(gatewayPort), "Unable to start the gateway")
|
||||||
|
|
||||||
// Validate if we have access, secret set through environment.
|
// Validate if we have access, secret set through environment.
|
||||||
if !globalIsEnvCreds {
|
if !globalIsEnvCreds {
|
||||||
|
Loading…
Reference in New Issue
Block a user