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"
|
2019-11-09 19:04:48 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
2019-11-09 19:47:26 +08:00
|
|
|
"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()
|
2019-11-09 19:04:48 +08:00
|
|
|
|
2019-11-09 19:47:26 +08:00
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
|
2019-11-09 19:04:48 +08:00
|
|
|
// 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
|
|
|
}
|