Files
houston-be/cmd/main.go
Shashank Shekhar 1f97532f50 Release 1 (#209)
* TP-43474 | Fixing time difference calculation issue (#193)

* TP-43298 | Adding SLA messagae to incident channel below incident summary (#183)

* TP-43298 | Resolving merge conflicts

* TP-43298 | Updating serverity check condition

* TP-43625 | Fixing user id check (#201)

* TP-43625 | Fixing user id check

* TP-43625 | Fixing user id check

* Incident service v2 (#191)

* TP-43339 | create-incident-v2

* TP-43339 | create-incident-v2 handler

* TP-43339 | added logs and some optimiations

* TP-43339 | added slack processor v2

* TP-43339 | create-incident-v2 integration with slack

* TP-43339 | adding feature flag for create-incident-v2

* TP-43339 | removed redundant entity fetch

* TP-43339 | Added SLA related changes to create-incident-v2

* TP-43339 | Posting incident summary to blazeGroup channel and improved logs

* TP-43339 | Moving post summary method to the incident service file

* TP-43339 | Removed socketModeClient usage from incident-service-v2, moved it to slack-service

* TP-43339 | Updated env variable for create-incident-v2

---------

Co-authored-by: Sriram Bhargav <sriram.bhargav@navi.com>
2023-10-09 16:04:04 +05:30

63 lines
1.6 KiB
Go

package main
import (
"houston/cmd/app"
"houston/config"
"houston/internal/clients"
"houston/pkg/postgres"
"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() {
logger, _ := zap.NewProduction()
config.LoadHoustonConfig(logger)
godotenv.Load()
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, time.RFC3339, true))
r.Use(ginzap.RecoveryWithZap(logger, true))
houston := r.Group("/houston")
db := postgres.NewGormClient(
viper.GetString("postgres.dsn"),
viper.GetString("postgres.connection.max.idle.time"),
viper.GetString("postgres.connection.max.lifetime"),
viper.GetInt("postgres.connections.max.idle"),
viper.GetInt("postgres.connections.max.open"),
logger,
)
httpClient := clients.NewHttpClient()
mjolnirClient := clients.NewMjolnirClient(httpClient.HttpClient, logger,
viper.GetString("mjolnir.service.url"), viper.GetString("mjolnir.realm.id"),
)
sv := app.NewServer(r, logger, db, 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)
}
}