mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-10 23:07:30 +08:00
fxi: component check output valid info.
Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com>
This commit is contained in:
parent
f185f09af7
commit
8d9e112fb1
@ -22,7 +22,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio-go/v7"
|
"github.com/minio/minio-go/v7"
|
||||||
@ -117,16 +116,24 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func exactIP(urll string) string {
|
func checkMinioIP() error {
|
||||||
u, _ := url.Parse(urll)
|
for _, i := range []string{config.Config.Object.ApiURL, config.Config.Object.Minio.SignEndpoint} {
|
||||||
host, _, err := net.SplitHostPort(u.Host)
|
u, err := url.Parse(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
host = u.Host
|
return utils.Wrap(err, "api format error,please check config file apiURL or Minio SignEndpoint")
|
||||||
|
}
|
||||||
|
if u.Scheme == "https" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
host, _, err := net.SplitHostPort(u.Host)
|
||||||
|
if err != nil {
|
||||||
|
host = u.Host
|
||||||
|
}
|
||||||
|
if host == "127.0.0.1" {
|
||||||
|
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1,please modify it")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(host, ":") {
|
return nil
|
||||||
host = host[0 : len(host)-1]
|
|
||||||
}
|
|
||||||
return host
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkMysql() error {
|
func checkMysql() error {
|
||||||
@ -205,8 +212,8 @@ func checkMinio() error {
|
|||||||
return ErrComponentStart.Wrap("Minio server is offline")
|
return ErrComponentStart.Wrap("Minio server is offline")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if exactIP(config.Config.Object.ApiURL) == "127.0.0.1" || exactIP(config.Config.Object.Minio.SignEndpoint) == "127.0.0.1" {
|
if checkMinioIP() != nil {
|
||||||
return ErrConfig.Wrap("apiURL or Minio SignEndpoint endpoint contain 127.0.0.1")
|
return checkMinioIP()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user