2019-11-04 20:30:12 +08:00
|
|
|
|
package main
|
|
|
|
|
|
2019-11-05 12:31:22 +08:00
|
|
|
|
import (
|
2020-03-09 16:53:01 +08:00
|
|
|
|
"flag"
|
2020-02-22 12:18:49 +08:00
|
|
|
|
"github.com/HFO4/cloudreve/bootstrap"
|
2019-11-16 16:11:37 +08:00
|
|
|
|
"github.com/HFO4/cloudreve/pkg/conf"
|
2020-03-09 16:53:01 +08:00
|
|
|
|
"github.com/HFO4/cloudreve/pkg/util"
|
2019-11-16 16:11:37 +08:00
|
|
|
|
"github.com/HFO4/cloudreve/routers"
|
2019-11-05 12:31:22 +08:00
|
|
|
|
)
|
2019-11-04 20:30:12 +08:00
|
|
|
|
|
2020-03-09 16:53:01 +08:00
|
|
|
|
var confPath string
|
|
|
|
|
|
2019-11-07 15:56:05 +08:00
|
|
|
|
func init() {
|
2020-03-11 10:32:35 +08:00
|
|
|
|
flag.StringVar(&confPath, "c", util.RelativePath("conf.ini"), "配置文件路径")
|
2020-03-09 16:53:01 +08:00
|
|
|
|
flag.Parse()
|
|
|
|
|
bootstrap.Init(confPath)
|
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()
|
2020-03-09 16:53:01 +08:00
|
|
|
|
util.Log().Info("开始监听 %s", conf.SystemConfig.Listen)
|
|
|
|
|
if err := api.Run(conf.SystemConfig.Listen); err != nil {
|
|
|
|
|
util.Log().Error("无法监听[%s],%s", conf.SystemConfig.Listen, err)
|
|
|
|
|
}
|
2019-11-04 20:30:12 +08:00
|
|
|
|
}
|