mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
fix: del get env in minio conneted
This commit is contained in:
parent
8d4e035226
commit
78a5e0b1cd
@ -18,10 +18,8 @@ import (
|
||||
"context"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"net/url"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/third"
|
||||
"github.com/OpenIMSDK/tools/discoveryregistry"
|
||||
@ -49,7 +47,7 @@ func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third {
|
||||
func minioInit() (*minio.Client, error) {
|
||||
minioClient := &minio.Client{}
|
||||
var initUrl string
|
||||
initUrl = getMinioAddr("MINIO_ENDPOINT", "MINIO_ADDRESS", "MINIO_PORT", config.Config.Object.Minio.Endpoint)
|
||||
initUrl = config.Config.Object.Minio.Endpoint
|
||||
minioUrl, err := url.Parse(initUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -69,17 +67,3 @@ func minioInit() (*minio.Client, error) {
|
||||
}
|
||||
return minioClient, 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…
x
Reference in New Issue
Block a user