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.
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"live/app/lib/config"
|
|
|
|
|
"live/app/router"
|
|
|
|
|
"live/app/task"
|
|
|
|
|
"log"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
if config.Config.Section("").Key("debug").MustBool() {
|
|
|
|
|
gin.ForceConsoleColor()
|
|
|
|
|
} else {
|
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
|
}
|
|
|
|
|
r := gin.Default()
|
|
|
|
|
|
|
|
|
|
if !config.Config.Section("").Key("debug").MustBool() {
|
|
|
|
|
// 直播主动拿回调任务
|
|
|
|
|
go task.Run()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 路由配置
|
|
|
|
|
router.Router(r)
|
|
|
|
|
if err := r.Run(config.Config.Section("").Key("addr").String()); err != nil {
|
|
|
|
|
log.Fatal("服务启动失败,err:", err)
|
|
|
|
|
}
|
|
|
|
|
}
|