Deprecate --listeners flag (#15900)

This commit is contained in:
Anis Elleuch 2022-10-19 16:45:50 +01:00 committed by GitHub
parent 374abd1e7d
commit de5070446d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 21 deletions

View File

@ -249,16 +249,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
getCert = globalTLSCerts.GetCertificate getCert = globalTLSCerts.GetCertificate
} }
listeners := ctx.Int("listeners") httpServer := xhttp.NewServer([]string{globalMinioAddr}).
if listeners == 0 {
listeners = 1
}
addrs := make([]string, 0, listeners)
for i := 0; i < listeners; i++ {
addrs = append(addrs, globalMinioAddr)
}
httpServer := xhttp.NewServer(addrs).
UseHandler(setCriticalErrorHandler(corsHandler(router))). UseHandler(setCriticalErrorHandler(corsHandler(router))).
UseTLSConfig(newTLSConfig(getCert)). UseTLSConfig(newTLSConfig(getCert)).
UseShutdownTimeout(ctx.Duration("shutdown-timeout")). UseShutdownTimeout(ctx.Duration("shutdown-timeout")).

View File

@ -57,10 +57,11 @@ var ServerFlags = []cli.Flag{
EnvVar: "MINIO_ADDRESS", EnvVar: "MINIO_ADDRESS",
}, },
cli.IntFlag{ cli.IntFlag{
Name: "listeners", Name: "listeners", // Deprecated Oct 2022
Value: 1, Value: 1,
Usage: "bind N number of listeners per ADDRESS:PORT", Usage: "bind N number of listeners per ADDRESS:PORT",
EnvVar: "MINIO_LISTENERS", EnvVar: "MINIO_LISTENERS",
Hidden: true,
}, },
cli.StringFlag{ cli.StringFlag{
Name: "console-address", Name: "console-address",
@ -499,16 +500,7 @@ func serverMain(ctx *cli.Context) {
getCert = globalTLSCerts.GetCertificate getCert = globalTLSCerts.GetCertificate
} }
listeners := ctx.Int("listeners") httpServer := xhttp.NewServer([]string{globalMinioAddr}).
if listeners == 0 {
listeners = 1
}
addrs := make([]string, 0, listeners)
for i := 0; i < listeners; i++ {
addrs = append(addrs, globalMinioAddr)
}
httpServer := xhttp.NewServer(addrs).
UseHandler(setCriticalErrorHandler(corsHandler(handler))). UseHandler(setCriticalErrorHandler(corsHandler(handler))).
UseTLSConfig(newTLSConfig(getCert)). UseTLSConfig(newTLSConfig(getCert)).
UseShutdownTimeout(ctx.Duration("shutdown-timeout")). UseShutdownTimeout(ctx.Duration("shutdown-timeout")).