mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 03:42:08 +08:00
fix: minio config
This commit is contained in:
parent
eb36ab810b
commit
d12008fdaf
@ -1,9 +1,7 @@
|
||||
bucket: "openim"
|
||||
port: 10005
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ''
|
||||
internalIP: localhost
|
||||
externalIP: 150.109.93.151
|
||||
url: https://image.rentsoft.cn/
|
||||
internalAddress: "minio:9000"
|
||||
externalAddress: "http://external_ip:10005"
|
||||
publicRead: false
|
||||
@ -22,6 +22,7 @@ import (
|
||||
"github.com/openimsdk/tools/s3/cos"
|
||||
"github.com/openimsdk/tools/s3/minio"
|
||||
"github.com/openimsdk/tools/s3/oss"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -52,13 +53,11 @@ type Log struct {
|
||||
|
||||
type Minio struct {
|
||||
Bucket string `mapstructure:"bucket"`
|
||||
Port int `mapstructure:"port"`
|
||||
AccessKeyID string `mapstructure:"accessKeyID"`
|
||||
SecretAccessKey string `mapstructure:"secretAccessKey"`
|
||||
SessionToken string `mapstructure:"sessionToken"`
|
||||
InternalIP string `mapstructure:"internalIP"`
|
||||
ExternalIP string `mapstructure:"externalIP"`
|
||||
URL string `mapstructure:"url"`
|
||||
InternalAddress string `mapstructure:"internalAddress"`
|
||||
ExternalAddress string `mapstructure:"externalAddress"`
|
||||
PublicRead bool `mapstructure:"publicRead"`
|
||||
}
|
||||
|
||||
@ -479,16 +478,20 @@ func (k *Kafka) Build() *kafka.Config {
|
||||
func (m *Minio) Build() *minio.Config {
|
||||
conf := minio.Config{
|
||||
Bucket: m.Bucket,
|
||||
Endpoint: fmt.Sprintf("http://%s:%d", m.InternalIP, m.Port),
|
||||
AccessKeyID: m.AccessKeyID,
|
||||
SecretAccessKey: m.SecretAccessKey,
|
||||
SessionToken: m.SessionToken,
|
||||
PublicRead: m.PublicRead,
|
||||
}
|
||||
if m.URL == "" {
|
||||
conf.SignEndpoint = fmt.Sprintf("http://%s:%d", m.ExternalIP, m.Port)
|
||||
if _, _, err := net.SplitHostPort(m.InternalAddress); err == nil {
|
||||
conf.Endpoint = fmt.Sprintf("http://%s", m.InternalAddress)
|
||||
} else {
|
||||
conf.SignEndpoint = m.URL
|
||||
conf.Endpoint = m.InternalAddress
|
||||
}
|
||||
if _, _, err := net.SplitHostPort(m.ExternalAddress); err == nil {
|
||||
conf.SignEndpoint = fmt.Sprintf("http://%s", m.ExternalAddress)
|
||||
} else {
|
||||
conf.SignEndpoint = m.ExternalAddress
|
||||
}
|
||||
return &conf
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user