Files
ipchub/main.go
2020-12-10 08:53:42 +08:00

41 lines
1.1 KiB
Go
Executable File

// Copyright (c) 2019,CAOHONGJU All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"github.com/cnotch/scheduler"
"github.com/cnotch/tomatox/config"
"github.com/cnotch/tomatox/provider/auth"
"github.com/cnotch/tomatox/provider/route"
"github.com/cnotch/xlog"
)
func main() {
// 初始化配置
config.InitConfig()
// 初始化全局计划任务
scheduler.SetPanicHandler(func(job *scheduler.ManagedJob, r interface{}) {
xlog.Errorf("scheduler task panic. tag: %v, recover: %v", job.Tag, r)
})
// 初始化各类提供者
// 路由表提供者
routetableProvider := config.LoadRoutetableProvider(route.JSON)
route.Reset(routetableProvider.(route.Provider))
// 用户提供者
userProvider := config.LoadUsersProvider(auth.JSON)
auth.Reset(userProvider.(auth.UserProvider))
// // Start new service
// svc, err := service.NewService(context.Background(), xlog.L())
// if err != nil {
// xlog.L().Panic(err.Error())
// }
// // Listen and serve
// svc.Listen()
}