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.
cloudreve/main.go

41 lines
836 B

5 years ago
package main
5 years ago
import (
"github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/aria2"
"github.com/HFO4/cloudreve/pkg/auth"
"github.com/HFO4/cloudreve/pkg/authn"
"github.com/HFO4/cloudreve/pkg/cache"
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/pkg/crontab"
"github.com/HFO4/cloudreve/pkg/email"
"github.com/HFO4/cloudreve/pkg/task"
"github.com/HFO4/cloudreve/routers"
"github.com/gin-gonic/gin"
5 years ago
)
5 years ago
func init() {
5 years ago
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()
task.Init()
aria2.Init()
email.Init()
crontab.Init()
}
auth.Init()
}
5 years ago
func main() {
5 years ago
api := routers.InitRouter()
api.Run(conf.SystemConfig.Listen)
5 years ago
5 years ago
}