init commit

This commit is contained in:
flswld
2022-11-20 15:38:00 +08:00
parent eda2b643b9
commit 3efed3defe
5834 changed files with 636508 additions and 0 deletions

31
wind/cmd/application.toml Normal file
View File

@@ -0,0 +1,31 @@
http_port = 80
[logger]
level = "DEBUG"
method = "CONSOLE"
track_line = true
[air]
addr = "air"
port = 8086
service_name = "wind-gateway"
[[routes]]
service_name = "water-auth"
service_predicates = "/api/v1/auth"
strip_prefix = 2
[[routes]]
service_name = "annie-user-app"
service_predicates = "/api/v1/user"
strip_prefix = 2
[[routes]]
service_name = "annie-wxmp-app"
service_predicates = "/api/v1/wxmp"
strip_prefix = 2
[[routes]]
service_name = "gm-hk4e-app"
service_predicates = "/api/v1/gm"
strip_prefix = 2

44
wind/cmd/main.go Normal file
View File

@@ -0,0 +1,44 @@
package main
import (
"flswld.com/common/config"
"flswld.com/logger"
"os"
"os/signal"
"syscall"
"time"
"wind/air"
"wind/entity"
"wind/proxy"
)
func main() {
filePath := "./application.toml"
config.InitConfig(filePath)
logger.InitLogger()
logger.LOG.Info("wind start")
svcAddrMap := new(entity.AddressMap)
svcAddrMap.Map = make(map[string][]string)
_ = air.NewAir(svcAddrMap)
_ = proxy.NewProxy(svcAddrMap)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
logger.LOG.Info("get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
logger.LOG.Info("wind exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}