gateway: Use default params when no args provided (#4315)

For S3 & Azure, use default parameters when no arguments (endpoint) are
provided. This also avoids a crash.
This commit is contained in:
Anis Elleuch
2017-05-12 07:38:22 +02:00
committed by Harshavardhana
parent b829ec4a6b
commit 5d602034ea
4 changed files with 39 additions and 32 deletions

View File

@@ -17,32 +17,24 @@
package cmd
import (
"bytes"
"context"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"hash"
"io"
"path"
"strconv"
"strings"
"encoding/hex"
"cloud.google.com/go/storage"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"encoding/base64"
"bytes"
// this package contains the url code of go 1.8
// due to compatibility with older versions
// copied it to our rep
"path"
"github.com/minio/cli"
minio "github.com/minio/minio-go"
"github.com/minio/minio-go/pkg/policy"
)
@@ -171,7 +163,7 @@ type gcsGateway struct {
}
// newGCSGateway returns gcs gatewaylayer
func newGCSGateway(args []string) (GatewayLayer, error) {
func newGCSGateway(args cli.Args) (GatewayLayer, error) {
if len(args) != 1 {
return nil, fmt.Errorf("ProjectID expected")
}
@@ -183,7 +175,7 @@ func newGCSGateway(args []string) (GatewayLayer, error) {
endpoint := "storage.googleapis.com"
secure := true
projectID := args[0]
projectID := args.First()
ctx := context.Background()