Cloudreve/main.go

30 lines
455 B
Go
Raw Normal View History

2019-11-04 20:30:12 +08:00
package main
2019-11-05 12:31:22 +08:00
import (
2019-11-16 16:11:37 +08:00
"github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/routers"
"github.com/gin-gonic/gin"
"math/rand"
"time"
2019-11-05 12:31:22 +08:00
)
2019-11-04 20:30:12 +08:00
2019-11-07 15:56:05 +08:00
func init() {
2019-11-09 18:06:29 +08:00
conf.Init("conf/conf.ini")
2019-11-07 15:56:05 +08:00
model.Init()
rand.Seed(time.Now().UnixNano())
// Debug 关闭时,切换为生产模式
if !conf.SystemConfig.Debug {
gin.SetMode(gin.ReleaseMode)
}
2019-11-07 15:56:05 +08:00
}
2019-11-04 20:30:12 +08:00
func main() {
2019-11-05 12:31:22 +08:00
api := routers.InitRouter()
api.Run(":5000")
2019-11-04 20:30:12 +08:00
}