Files
houston-be/cmd/main.go
Vijay Joshi 2eba625b0d INFRA-2888 : Added custom metrics on all major flows (#393)
* INFRA-2888 : Added alerts on all major flows

* INFRA-2888 : Remove unnecessary space

* INFRA-2888 : Metric handler

* INFRA-2888 : Review changes

* INFRA-2888 : Build fix

* INFRA-2888 : Code cleanup

* INFRA-2888 : Review comments round 1

* INFRA-2888 : Err msg changes

* INFRA-2888 : task to job in name
2024-03-12 19:56:52 +05:30

60 lines
1.4 KiB
Go

package main
import (
"houston/appcontext"
"houston/cmd/app"
"houston/config"
"houston/internal/clients"
"houston/logger"
"os"
"time"
"github.com/spf13/viper"
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() {
config.LoadHoustonConfig()
godotenv.Load()
logger.InitLogger()
appcontext.InitiateContext()
appcontext.InitializeServices()
command := &cobra.Command{
Use: "houston",
Short: "houston is replacement for blameless and incident management slackbot bot at Navi",
Long: "houston is replacement for blameless and incident management slackbot bot at Navi",
RunE: func(cmd *cobra.Command, args []string) error {
r := gin.New()
r.Use(ginzap.Ginzap(logger.GetLogger(), time.RFC3339, true))
r.Use(ginzap.RecoveryWithZap(logger.GetLogger(), true))
houston := r.Group("/houston")
httpClient := clients.NewHttpClient()
mjolnirClient := clients.NewMjolnirClient(
httpClient.HttpClient,
viper.GetString("mjolnir.service.url"),
viper.GetString("mjolnir.realm.id"),
)
sv := app.NewServer(r, appcontext.GetDB(), mjolnirClient)
sv.Handler(houston)
sv.Start()
return nil
},
}
if err := command.Execute(); err != nil {
logger.Error("houston core command execution failed", zap.Error(err))
os.Exit(1)
}
}