Check for address flags in all positions (#9615)

Fixes #9599
master
kannappanr 5 years ago committed by GitHub
parent 011a2c0b78
commit a62572fb86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/common-main.go
  2. 7
      cmd/gateway/azure/gateway-azure.go
  3. 8
      cmd/gateway/s3/gateway-s3.go
  4. 4
      cmd/globals.go
  5. 2
      cmd/server-main.go

@ -145,7 +145,7 @@ func handleCommonCmdArgs(ctx *cli.Context) {
// Fetch address option // Fetch address option
globalCLIContext.Addr = ctx.GlobalString("address") globalCLIContext.Addr = ctx.GlobalString("address")
if globalCLIContext.Addr == "" || globalCLIContext.Addr == ":"+globalMinioDefaultPort { if globalCLIContext.Addr == "" || globalCLIContext.Addr == ":"+GlobalMinioDefaultPort {
globalCLIContext.Addr = ctx.String("address") globalCLIContext.Addr = ctx.String("address")
} }

@ -130,8 +130,13 @@ func isAzureMarker(marker string) bool {
func azureGatewayMain(ctx *cli.Context) { func azureGatewayMain(ctx *cli.Context) {
// Validate gateway arguments. // Validate gateway arguments.
host := ctx.Args().First() host := ctx.Args().First()
serverAddr := ctx.GlobalString("address")
if serverAddr == "" || serverAddr == ":"+minio.GlobalMinioDefaultPort {
serverAddr = ctx.String("address")
}
// Validate gateway arguments. // Validate gateway arguments.
logger.FatalIf(minio.ValidateGatewayArguments(ctx.GlobalString("address"), host), "Invalid argument") logger.FatalIf(minio.ValidateGatewayArguments(serverAddr, host), "Invalid argument")
minio.StartGateway(ctx, &Azure{host}) minio.StartGateway(ctx, &Azure{host})
} }

@ -1,5 +1,5 @@
/* /*
* MinIO Cloud Storage, (C) 2017, 2018, 2019 MinIO, Inc. * MinIO Cloud Storage, (C) 2017-2020 MinIO, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -89,8 +89,12 @@ func s3GatewayMain(ctx *cli.Context) {
args = cli.Args{"https://s3.amazonaws.com"} args = cli.Args{"https://s3.amazonaws.com"}
} }
serverAddr := ctx.GlobalString("address")
if serverAddr == "" || serverAddr == ":"+minio.GlobalMinioDefaultPort {
serverAddr = ctx.String("address")
}
// Validate gateway arguments. // Validate gateway arguments.
logger.FatalIf(minio.ValidateGatewayArguments(ctx.GlobalString("address"), args.First()), "Invalid argument") logger.FatalIf(minio.ValidateGatewayArguments(serverAddr, args.First()), "Invalid argument")
// Start the gateway.. // Start the gateway..
minio.StartGateway(ctx, &S3{args.First()}) minio.StartGateway(ctx, &S3{args.First()})

@ -43,7 +43,7 @@ import (
// minio configuration related constants. // minio configuration related constants.
const ( const (
globalMinioDefaultPort = "9000" GlobalMinioDefaultPort = "9000"
globalMinioDefaultRegion = "" globalMinioDefaultRegion = ""
// This is a sha256 output of ``arn:aws:iam::minio:user/admin``, // This is a sha256 output of ``arn:aws:iam::minio:user/admin``,
@ -133,7 +133,7 @@ var (
// MinIO local server address (in `host:port` format) // MinIO local server address (in `host:port` format)
globalMinioAddr = "" globalMinioAddr = ""
// MinIO default port, can be changed through command line. // MinIO default port, can be changed through command line.
globalMinioPort = globalMinioDefaultPort globalMinioPort = GlobalMinioDefaultPort
// Holds the host that was passed using --address // Holds the host that was passed using --address
globalMinioHost = "" globalMinioHost = ""
// Holds the possible host endpoint. // Holds the possible host endpoint.

@ -42,7 +42,7 @@ import (
var ServerFlags = []cli.Flag{ var ServerFlags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "address", Name: "address",
Value: ":" + globalMinioDefaultPort, Value: ":" + GlobalMinioDefaultPort,
Usage: "bind to a specific ADDRESS:PORT, ADDRESS can be an IP or hostname", Usage: "bind to a specific ADDRESS:PORT, ADDRESS can be an IP or hostname",
}, },
} }

Loading…
Cancel
Save