1
0
mirror of synced 2024-11-21 20:46:05 +03:00

fix tg example

This commit is contained in:
Pavel 2023-12-29 11:19:45 +03:00
parent 7b482b17bc
commit f2a74857b7
2 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,7 @@ func RegisterSystem() {
AccountURL: AppConfig.BaseURL,
Integrations: &retailcrm.Integrations{
MgTransport: &retailcrm.MgTransport{
WebhookURL: AppConfig.BaseURL + "/api/v1/webhook",
WebhookURL: AppConfig.BaseURL + "/api/v1/mg",
},
},
})

View File

@ -39,10 +39,11 @@ func Listen() {
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
log.Println("shutting down, please wait...")
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := srv.Shutdown(ctx); err != nil {
log.Fatal("shutting down:", err)
log.Fatal("shutdown error:", err)
}
select {
case <-ctx.Done():
@ -65,7 +66,7 @@ func MGWebhookHandler(c *gin.Context) {
}
whMsg := wh.MessageWebhookData()
if strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
if !strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
c.AbortWithStatusJSON(http.StatusUnprocessableEntity,
v1.NewTransportErrorResponse(v1.MessageErrorGeneral, "unexpected chat ID"))
return