26 lines
585 B
Go
26 lines
585 B
Go
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)
|
|
}
|
|
}
|