36 lines
632 B
Go
36 lines
632 B
Go
|
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"),
|
||
|
)
|
||
|
}
|