From f16b7d694b256882a0a7656e2b8a54ea6af946a3 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Sun, 24 Apr 2022 11:50:36 +0800 Subject: [PATCH] fix docker-compose --- cmd/open_im_cms_api/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/open_im_cms_api/main.go b/cmd/open_im_cms_api/main.go index 262020fea..024439075 100644 --- a/cmd/open_im_cms_api/main.go +++ b/cmd/open_im_cms_api/main.go @@ -3,7 +3,9 @@ package main import ( "Open_IM/internal/cms_api" "Open_IM/pkg/utils" + "flag" "fmt" + "strconv" "github.com/gin-gonic/gin" ) @@ -12,6 +14,7 @@ func main() { gin.SetMode(gin.ReleaseMode) router := cms_api.NewGinRouter() router.Use(utils.CorsHandler()) - fmt.Println("start cms api server, port: ", 8000) - router.Run(":" + "8000") + ginPort := flag.Int("port", 8000, "get ginServerPort from cmd,default 10000 as port") + fmt.Println("start cms api server, port: ", ginPort) + router.Run(":" + strconv.Itoa(*ginPort)) }