You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

60 lines
1.2 KiB

package main
import (
"fmt"
"gitea.baoapi.com/root/stu_uuos/lib/logruspan"
"log"
"time"
"gitea.baoapi.com/root/stu_uuos/lib/nats"
"gitea.baoapi.com/root/stu_uuos/lib/redis"
"gitea.baoapi.com/root/stu_uuos/micro"
"gitea.baoapi.com/root/stu_uuos/web/router"
"github.com/micro/go-micro/v2/web"
"gitea.baoapi.com/root/stu_uuos/config"
"gitea.baoapi.com/root/stu_uuos/lib/db"
"gitea.baoapi.com/root/stu_uuos/logger"
_ "github.com/micro/go-plugins/registry/kubernetes/v2"
)
func init() {
config.Init()
logger.Init()
logruspan.LogInitHttp()
db.Init()
db.InitTable()
redis.Init()
nats.Init()
micro.InitMicro()
//监听同步任务
}
func main() {
service := web.NewService(
web.Name(config.GetConfig().ServiceName),
web.Version(config.GetConfig().Version),
web.Address(fmt.Sprintf(":%d", config.GetConfig().Address)),
web.RegisterTTL(time.Second*30),
web.RegisterInterval(time.Second*15),
web.Handler(router.Init()),
web.AfterStop(func() error {
return db.Close()
}),
//web.Secure(true),
//web.TLSConfig(gomicro.LoadTlsConfig()),
)
//handler.InitDatab()
if err := service.Init(); err != nil {
log.Fatal(err)
}
if err := service.Run(); err != nil {
log.Fatal(err)
}
}
// t1