|
|
|
@ -21,7 +21,6 @@ import (
|
|
|
|
|
"io"
|
|
|
|
|
"net/http"
|
|
|
|
|
"net/url"
|
|
|
|
|
"os"
|
|
|
|
|
"path"
|
|
|
|
|
"reflect"
|
|
|
|
|
"strconv"
|
|
|
|
@ -61,8 +60,7 @@ const (
|
|
|
|
|
const successCode = http.StatusOK
|
|
|
|
|
|
|
|
|
|
func NewMinio(cache cache.MinioCache) (s3.Interface, error) {
|
|
|
|
|
initUrl := getMinioAddr("MINIO_ENDPOINT", "MINIO_ADDRESS", "MINIO_PORT", config.Config.Object.Minio.Endpoint)
|
|
|
|
|
u, err := url.Parse(initUrl)
|
|
|
|
|
u, err := url.Parse(config.Config.Object.Minio.Endpoint)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -493,17 +491,3 @@ func (m *Minio) FormData(ctx context.Context, name string, size int64, contentTy
|
|
|
|
|
SuccessCodes: []int{successCode},
|
|
|
|
|
}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getMinioAddr(key1, key2, key3, fallback string) string {
|
|
|
|
|
// Prioritize environment variables
|
|
|
|
|
endpoint, endpointExist := os.LookupEnv(key1)
|
|
|
|
|
if !endpointExist {
|
|
|
|
|
endpoint = fallback
|
|
|
|
|
}
|
|
|
|
|
address, addressExist := os.LookupEnv(key2)
|
|
|
|
|
port, portExist := os.LookupEnv(key3)
|
|
|
|
|
if portExist && addressExist {
|
|
|
|
|
endpoint = "http://" + address + ":" + port
|
|
|
|
|
}
|
|
|
|
|
return endpoint
|
|
|
|
|
}
|
|
|
|
|