Cloudreve/main.go

26 lines
593 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 (
2020-03-09 03:53:01 -05:00
"flag"
"github.com/HFO4/cloudreve/bootstrap"
2019-11-16 03:11:37 -05:00
"github.com/HFO4/cloudreve/pkg/conf"
2020-03-09 03:53:01 -05:00
"github.com/HFO4/cloudreve/pkg/util"
2019-11-16 03:11:37 -05:00
"github.com/HFO4/cloudreve/routers"
2019-11-04 23:31:22 -05:00
)
2019-11-04 07:30:12 -05:00
2020-03-09 03:53:01 -05:00
var confPath string
2019-11-07 02:56:05 -05:00
func init() {
2020-03-10 21:32:35 -05:00
flag.StringVar(&confPath, "c", util.RelativePath("conf.ini"), "配置文件路径")
2020-03-09 03:53:01 -05:00
flag.Parse()
bootstrap.Init(confPath)
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()
2020-03-09 03:53:01 -05: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 07:30:12 -05:00
}