hpds_access_point/cmd/server.go

36 lines
632 B
Go
Raw Normal View History

2022-10-17 16:41:25 +08:00
package cmd
import (
"context"
"os"
"os/signal"
"syscall"
"git.hpds.cc/pavement/hpds_node"
discover "hpds_access_point/internal/discover/consul"
)
var (
consulConfigs chan *discover.ConsulConfig
)
func Run() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// 退出channel
exitChannel := make(chan os.Signal)
defer close(exitChannel)
// 退出信号监听
go func(c chan os.Signal) {
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
}(exitChannel)
ap := hpds_node.NewAccessPoint(
"hpds-ap",
hpds_node.WithMqAddr("localhost:27188"),
hpds_node.WithCredential("token:z1"),
)
}