Files
houston-be/cmd/main.go
Shashank Shekhar 88459577f4 TP-49403 | parameterized slash command (#297)
* TP-49403 | parameterized slash command

* TP-49403 | handeling resolve and rca params also implemented Help-Commands button

* TP-49403 | using command pattern for command resolutiuon and execution

* TP-49403 | made find team by name and find severity by name queries case insensitive

* TP-49403 | updating help message keys
2023-11-30 11:56:32 +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)
}
}