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