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"
|
2019-12-10 11:55:28 +08:00
|
|
|
"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"
|
2019-11-09 19:04:48 +08:00
|
|
|
"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")
|
2019-12-10 11:55:28 +08:00
|
|
|
cache.Init()
|
2019-11-07 15:56:05 +08:00
|
|
|
model.Init()
|
2019-11-09 19:04:48 +08:00
|
|
|
|
|
|
|
// 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
|
|
|
}
|