|
|
@ -20,11 +20,13 @@ import ( |
|
|
|
"crypto/md5" |
|
|
|
"crypto/md5" |
|
|
|
"encoding/base64" |
|
|
|
"encoding/base64" |
|
|
|
"encoding/hex" |
|
|
|
"encoding/hex" |
|
|
|
|
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"hash" |
|
|
|
"hash" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
"net/url" |
|
|
|
"net/url" |
|
|
|
|
|
|
|
"os" |
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
"sync" |
|
|
@ -153,11 +155,23 @@ func azureToObjectError(err error, params ...string) error { |
|
|
|
return e |
|
|
|
return e |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Inits azure blob storage client and returns azureObjects.
|
|
|
|
// Inits azure blob storage client and returns AzureObjects.
|
|
|
|
func newAzureLayer(endPoint string, account, key string, secure bool) (GatewayLayer, error) { |
|
|
|
func newAzureLayer(args []string) (GatewayLayer, error) { |
|
|
|
|
|
|
|
endPoint, secure, err := parseGatewayEndpoint(args[0]) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if endPoint == "" { |
|
|
|
if endPoint == "" { |
|
|
|
endPoint = storage.DefaultBaseURL |
|
|
|
endPoint = storage.DefaultBaseURL |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
account := os.Getenv("MINIO_ACCESS_KEY") |
|
|
|
|
|
|
|
key := os.Getenv("MINIO_SECRET_KEY") |
|
|
|
|
|
|
|
if account == "" || key == "" { |
|
|
|
|
|
|
|
return nil, errors.New("No Azure account and key set") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
c, err := storage.NewClient(account, key, endPoint, globalAzureAPIVersion, secure) |
|
|
|
c, err := storage.NewClient(account, key, endPoint, globalAzureAPIVersion, secure) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return &azureObjects{}, err |
|
|
|
return &azureObjects{}, err |
|
|
|