Files
alfred-be/alfred/cmd/ingester/main.go
2026-03-08 16:14:42 +05:30

47 lines
1.0 KiB
Go

package main
import (
"alfred/cmd/ingester/app"
"alfred/cmd/ingester/app/tracer"
"alfred/config"
"alfred/pkg/log"
"context"
ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"github.com/spf13/cobra"
_ "go.uber.org/automaxprocs"
"go.uber.org/zap"
"os"
)
var serviceName = "alfred-ingester"
func main() {
log.InitLogger(serviceName)
config.LoadIngesterConfig()
tracer.InitTracer(context.Background(), serviceName)
command := &cobra.Command{
Use: "alfred-ingester",
Short: "alfred ingester receive all app events and ingest them into kafka",
Long: "alfred ingester receive all app events and ingest them into kafka",
RunE: func(cmd *cobra.Command, args []string) error {
r := gin.New()
//r.Use(ginzap.Ginzap(logger, time.RFC3339, true))
r.Use(ginzap.RecoveryWithZap(log.GetLogger(), true))
sv := app.NewServer(r)
sv.Handler()
sv.Start()
return nil
},
}
if err := command.Execute(); err != nil {
log.Error("alfred ingester main command execution failed", zap.Error(err))
os.Exit(1)
}
}