mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 21:50:22 +03:00
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:
committed by
Harshavardhana
parent
b829ec4a6b
commit
5d602034ea
+17
-9
@@ -17,13 +17,15 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/minio/cli"
|
||||
minio "github.com/minio/minio-go"
|
||||
"github.com/minio/minio-go/pkg/policy"
|
||||
)
|
||||
@@ -99,15 +101,21 @@ type s3Objects struct {
|
||||
}
|
||||
|
||||
// newS3Gateway returns s3 gatewaylayer
|
||||
func newS3Gateway(args []string) (GatewayLayer, error) {
|
||||
endpoint, secure, err := parseGatewayEndpoint(args[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func newS3Gateway(args cli.Args) (GatewayLayer, error) {
|
||||
|
||||
if endpoint == "" {
|
||||
endpoint = "s3.amazonaws.com"
|
||||
secure = true
|
||||
var err error
|
||||
|
||||
// Default endpoint parameters
|
||||
endpoint := "s3.amazonaws.com"
|
||||
secure := true
|
||||
|
||||
// Check if user provided some parameters
|
||||
if len(args) > 0 {
|
||||
// Override default params if the endpoint is provided
|
||||
endpoint, secure, err = parseGatewayEndpoint(args.First())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
accessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||
|
||||
Reference in New Issue
Block a user