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