You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
911 B
Go

5 months ago
package main
import (
"flag"
"github.com/gin-gonic/gin"
"insure/global"
"insure/initialize"
"insure/route"
)
func main() {
initial()
//testVerify()
//runServer()
runServerInWindows()
}
func initial() {
var configFilePath string
flag.StringVar(&configFilePath, "config", "./config.yaml", "配置文件")
flag.Parse()
global.Config = initialize.InitConfig(configFilePath)
global.DB = initialize.InitDB(global.Config)
global.Redis = initialize.InitRedis(global.Config)
}
/*func runServer() {
r := gin.Default()
s := &http.Server{
Addr: ":8080",
Handler: r,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
route.Initial(r)
err := endless.ListenAndServe(":"+global.Config.Server.Port, s.Handler)
if err != nil {
panic(err)
}
}*/
func runServerInWindows() {
r := gin.Default()
route.Initial(r)
r.Run(":9090")
}