feat: replace iot adapter with mqtt command pipeline
This commit is contained in:
30
backend/iot-server/cmd/main/main.go
Normal file
30
backend/iot-server/cmd/main/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"git.apinb.com/heqiapp/platforms/backend/iot-server/internal/config"
|
||||
"git.apinb.com/heqiapp/platforms/backend/iot-server/internal/service"
|
||||
)
|
||||
|
||||
func main() {
|
||||
path := flag.String("config", "etc/platform_iot_server_dev.yaml", "YAML 配置文件")
|
||||
flag.Parse()
|
||||
cfg, err := config.Load(*path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
srv, err := service.New(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
if err = srv.Run(ctx); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user