fix: del the minio env

pull/1846/head
luhaoling 2 years ago
parent 922058b868
commit a2839192af

@ -21,7 +21,6 @@ import (
"io" "io"
"net/http" "net/http"
"net/url" "net/url"
"os"
"path" "path"
"reflect" "reflect"
"strconv" "strconv"
@ -61,8 +60,7 @@ const (
const successCode = http.StatusOK const successCode = http.StatusOK
func NewMinio(cache cache.MinioCache) (s3.Interface, error) { 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(config.Config.Object.Minio.Endpoint)
u, err := url.Parse(initUrl)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -493,17 +491,3 @@ func (m *Minio) FormData(ctx context.Context, name string, size int64, contentTy
SuccessCodes: []int{successCode}, SuccessCodes: []int{successCode},
}, nil }, 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
}

Loading…
Cancel
Save