mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-18 12:07:01 +08:00
815
Signed-off-by: hanzhixiao <709674996@qq.com>
This commit is contained in:
parent
cfe7f3dd9b
commit
f82db1febc
@ -34,8 +34,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrComponentStart = errs.NewCodeError(componentStartErr, "ComponentStartErr")
|
||||
Errconfig = errs.NewCodeError(configErr, "")
|
||||
ErrComponentStart = errs.NewCodeError(componentStartErrCode, "ComponentStartErr")
|
||||
ErrConfig = errs.NewCodeError(configErrCode, "Config file is incorrect")
|
||||
)
|
||||
|
||||
func initCfg() error {
|
||||
@ -77,7 +77,11 @@ func main() {
|
||||
|
||||
// Check Minio
|
||||
if err := checkMinio(); err != nil {
|
||||
errorPrint(fmt.Sprintf("Starting Minio failed: %v.Please make sure your Minio service has started", err.Error()))
|
||||
if index := strings.Index(err.Error(), utils.IntToString(configErrCode)); index != -1 {
|
||||
warningPrint(fmt.Sprintf("%v Please modify your config file", err.Error()))
|
||||
} else {
|
||||
errorPrint(fmt.Sprintf("Starting Minio failed: %v.Please make sure your Minio service has started", err.Error()))
|
||||
}
|
||||
continue
|
||||
} else {
|
||||
successPrint(fmt.Sprint("Minio starts successfully"))
|
||||
@ -166,7 +170,7 @@ func checkMongo() error {
|
||||
func checkMinio() error {
|
||||
if config.Config.Object.Enable == "minio" {
|
||||
if exactIP(config.Config.Object.ApiURL) == "127.0.0.1" || exactIP(config.Config.Object.Minio.Endpoint) == "127.0.0.1" {
|
||||
return ErrComponentStart.Wrap("apiURL or endpoint contain 127.0.0.1. Please modify your config file")
|
||||
return ErrConfig.Wrap("apiURL or endpoint contain 127.0.0.1.")
|
||||
}
|
||||
conf := config.Config.Object.Minio
|
||||
u, _ := url.Parse(conf.Endpoint)
|
||||
@ -269,3 +273,7 @@ func errorPrint(s string) {
|
||||
func successPrint(s string) {
|
||||
fmt.Printf("\x1b[%dm%v\x1b[0m\n", 32, s)
|
||||
}
|
||||
|
||||
func warningPrint(s string) {
|
||||
fmt.Printf("\x1b[%dmhello world\x1b[0m\n", 33)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user