fix: allow dynamic ports for API only in non-distributed setups (#18019)

fixes #17998
This commit is contained in:
Harshavardhana
2023-09-12 19:10:49 -07:00
committed by GitHub
parent 65939913b4
commit b1c2dacab3
3 changed files with 23 additions and 8 deletions
+10 -1
View File
@@ -391,7 +391,7 @@ func handleCommonCmdArgs(ctx *cli.Context) {
if consoleAddr == "" {
p, err := xnet.GetFreePort()
if err != nil {
logger.FatalIf(err, "Unable to get free port for console on the host")
logger.FatalIf(err, "Unable to get free port for Console UI on the host")
}
consoleAddr = net.JoinHostPort("", p.String())
}
@@ -405,6 +405,15 @@ func handleCommonCmdArgs(ctx *cli.Context) {
}
globalMinioHost, globalMinioPort = mustSplitHostPort(addr)
if globalMinioPort == "0" {
p, err := xnet.GetFreePort()
if err != nil {
logger.FatalIf(err, "Unable to get free port for S3 API on the host")
}
globalMinioPort = p.String()
globalDynamicAPIPort = true
}
globalMinioConsoleHost, globalMinioConsolePort = mustSplitHostPort(consoleAddr)
if globalMinioPort == globalMinioConsolePort {