wireguard-dashboard/main.go
coward 8fb39958d2
All checks were successful
continuous-integration/drone/tag Build is passing
🎨
2024-05-09 09:39:52 +08:00

41 lines
812 B
Go

package main
import (
"fmt"
"gitee.ltd/lxh/logger/log"
"net/http"
"wireguard-dashboard/config"
"wireguard-dashboard/initialize"
"wireguard-dashboard/queues"
"wireguard-dashboard/route"
"wireguard-dashboard/script"
)
func init() {
initialize.Init() // 初始化
if err := script.NewScript().Do(); err != nil {
log.Errorf("执行脚本失败: %v", err.Error())
}
go queues.StartConsumer() // 启动队列
}
func main() {
route.IncludeRouters(
route.CaptchaApi,
route.UserApi,
route.ServerApi,
route.ClientApi,
route.SettingApi,
)
handler := route.InitRouter()
httpServe := http.Server{
Addr: fmt.Sprintf(":%d", config.Config.Http.Port),
Handler: handler,
}
if err := httpServe.ListenAndServe(); err != nil {
log.Panicf("启动http服务端失败: %v", err.Error())
}
}