Files
houston-be/cmd/main.go
Shubham Kirve b974cb6bf3 TP-0000 | Initialize houston repo (#1)
* TP-0000 | intialize houston repo

* TP-0000 | intialize houston repo
2023-03-29 00:01:17 +05:30

47 lines
1009 B
Go

package main
import (
"houston/cmd/app"
"houston/config"
"houston/pkg/postgres"
"os"
"time"
ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
func main() {
logger, _ := zap.NewProduction()
config.LoadHoustonConfig(logger)
godotenv.Load()
command := &cobra.Command{
Use: "houston",
Short: "houston is replacement for blameless and incident management slack bot at Navi",
Long: "houston is replacement for blameless and incident management slack bot at Navi",
RunE: func(cmd *cobra.Command, args []string) error {
r := gin.New()
r.Use(ginzap.Ginzap(logger, time.RFC3339, true))
r.Use(ginzap.RecoveryWithZap(logger, true))
db := postgres.PQConnection(logger)
sv := app.NewServer(r, logger, db)
sv.Handler()
sv.Start()
return nil
},
}
if err := command.Execute(); err != nil {
logger.Error("alfred core command execution failed", zap.Error(err))
os.Exit(1)
}
}