Cloudreve/main.go

33 lines
618 B
Go
Raw Normal View History

2019-11-04 07:30:12 -05:00
package main
2019-11-04 23:31:22 -05:00
import (
2019-11-16 03:11:37 -05:00
"github.com/HFO4/cloudreve/models"
2019-12-09 22:13:33 -05:00
"github.com/HFO4/cloudreve/pkg/auth"
2019-12-08 09:17:36 -05:00
"github.com/HFO4/cloudreve/pkg/authn"
"github.com/HFO4/cloudreve/pkg/cache"
2019-11-16 03:11:37 -05:00
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/routers"
"github.com/gin-gonic/gin"
2019-11-04 23:31:22 -05:00
)
2019-11-04 07:30:12 -05:00
2019-11-07 02:56:05 -05:00
func init() {
2019-11-09 05:06:29 -05:00
conf.Init("conf/conf.ini")
// Debug 关闭时,切换为生产模式
if !conf.SystemConfig.Debug {
gin.SetMode(gin.ReleaseMode)
}
cache.Init()
if conf.SystemConfig.Mode == "master" {
model.Init()
authn.Init()
}
2019-12-09 22:13:33 -05:00
auth.Init()
2019-11-07 02:56:05 -05:00
}
2019-11-04 07:30:12 -05:00
func main() {
2019-11-04 23:31:22 -05:00
api := routers.InitRouter()
api.Run(conf.SystemConfig.Listen)
2019-11-04 23:31:22 -05:00
2019-11-04 07:30:12 -05:00
}