Cloudreve/main.go

32 lines
556 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"
2019-12-10 11:13:33 +08:00
"github.com/HFO4/cloudreve/pkg/auth"
2019-12-08 22:17:36 +08:00
"github.com/HFO4/cloudreve/pkg/authn"
"github.com/HFO4/cloudreve/pkg/cache"
2019-11-16 16:11:37 +08:00
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/routers"
"github.com/gin-gonic/gin"
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")
cache.Init()
2019-11-07 15:56:05 +08:00
model.Init()
// Debug 关闭时,切换为生产模式
if !conf.SystemConfig.Debug {
gin.SetMode(gin.ReleaseMode)
}
2019-12-10 11:13:33 +08:00
auth.Init()
2019-12-08 22:17:36 +08:00
authn.Init()
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
}