You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
684 B
28 lines
684 B
package main
|
|
|
|
import (
|
|
"Open_IM/internal/cms_api"
|
|
"Open_IM/pkg/utils"
|
|
"flag"
|
|
"fmt"
|
|
"strconv"
|
|
|
|
"Open_IM/pkg/common/config"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func main() {
|
|
gin.SetMode(gin.ReleaseMode)
|
|
router := cms_api.NewGinRouter()
|
|
router.Use(utils.CorsHandler())
|
|
ginPort := flag.Int("port", 10006, "get ginServerPort from cmd,default 10006 as port")
|
|
flag.Parse()
|
|
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
|
if config.Config.Api.ListenIP != "" {
|
|
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
|
}
|
|
address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort)
|
|
fmt.Println("start cms api server, address: ", address)
|
|
router.Run(address)
|
|
}
|