mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 06:26:17 +03:00
Make every backend responsible for parsing its own arguments, fixes #4293
This commit is contained in:
committed by
Harshavardhana
parent
2d814e340f
commit
bf55591c64
+14
-1
@@ -18,8 +18,10 @@ package cmd
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
minio "github.com/minio/minio-go"
|
||||
@@ -97,12 +99,23 @@ type s3Objects struct {
|
||||
}
|
||||
|
||||
// newS3Gateway returns s3 gatewaylayer
|
||||
func newS3Gateway(endpoint string, accessKey, secretKey string, secure bool) (GatewayLayer, error) {
|
||||
func newS3Gateway(args []string) (GatewayLayer, error) {
|
||||
endpoint, secure, err := parseGatewayEndpoint(args[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if endpoint == "" {
|
||||
endpoint = "s3.amazonaws.com"
|
||||
secure = true
|
||||
}
|
||||
|
||||
accessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||
secretKey := os.Getenv("MINIO_SECRET_KEY")
|
||||
if accessKey == "" || secretKey == "" {
|
||||
return nil, errors.New("No S3 access and secret key")
|
||||
}
|
||||
|
||||
// Initialize minio client object.
|
||||
client, err := minio.NewCore(endpoint, accessKey, secretKey, secure)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user