diff --git a/config.yml.dist b/config.yml.dist index 1ea6923..0197ce3 100644 --- a/config.yml.dist +++ b/config.yml.dist @@ -1,3 +1,5 @@ +version: ~ + database: connection: postgres://mg_telegram:mg_telegram@postgres:5432/mg_telegram?sslmode=disable diff --git a/config_test.yml.dist b/config_test.yml.dist index f49d041..3e07ac8 100644 --- a/config_test.yml.dist +++ b/config_test.yml.dist @@ -1,3 +1,5 @@ +version: ~ + database: connection: postgres://mg_telegram_test:mg_telegram_test@postgres_test:5432/mg_telegram_test?sslmode=disable diff --git a/src/config.go b/src/config.go index 6fdedda..661dd23 100644 --- a/src/config.go +++ b/src/config.go @@ -10,6 +10,7 @@ import ( // TransportConfig struct type TransportConfig struct { + Version string `yaml:"version"` LogLevel logging.Level `yaml:"log_level"` Database DatabaseConfig `yaml:"database"` SentryDSN string `yaml:"sentry_dsn"` diff --git a/src/locale.go b/src/locale.go index cf275c1..2e28ebe 100644 --- a/src/locale.go +++ b/src/locale.go @@ -50,6 +50,7 @@ func getLocalizedTemplateMessage(messageID string, templateData map[string]inter func getLocale() map[string]interface{} { return map[string]interface{}{ + "Version": config.Version, "ButtonSave": getLocalizedMessage("button_save"), "ApiKey": getLocalizedMessage("api_key"), "TabSettings": getLocalizedMessage("tab_settings"), diff --git a/src/routing.go b/src/routing.go index 94560c6..9024953 100644 --- a/src/routing.go +++ b/src/routing.go @@ -431,7 +431,10 @@ func telegramWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("mgWebhookHandler request: %v", update) + logger.Debugf( + "mgWebhookHandler request:\nUpdateID: %v,\nMessage: %+v,\nEditedMessage: %+v", + update.UpdateID, update.Message, update.EditedMessage, + ) } var client = v1.New(conn.MGURL, conn.MGToken) @@ -486,7 +489,7 @@ func telegramWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("telegramWebhookHandler user %v", user) + logger.Debugf("telegramWebhookHandler user %+v", user) } snd := v1.SendData{ @@ -519,7 +522,7 @@ func telegramWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("telegramWebhookHandler Type: SendMessage, Bot: %v, Message: %v, Response: %v", b.ID, snd, data) + logger.Debugf("telegramWebhookHandler Type: SendMessage, Bot: %v, Message: %+v, Response: %+v", b.ID, snd, data) } } @@ -575,7 +578,7 @@ func mgWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("mgWebhookHandler request: %v", msg) + logger.Debugf("mgWebhookHandler request: %+v", msg) } uid, _ := strconv.Atoi(msg.Data.ExternalMessageID) @@ -649,7 +652,7 @@ func mgWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("mgWebhookHandler sent %v", msgSend) + logger.Debugf("mgWebhookHandler sent %+v", msgSend) } c.JSON(http.StatusOK, gin.H{"external_message_id": strconv.Itoa(msgSend.MessageID)}) @@ -663,7 +666,7 @@ func mgWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("mgWebhookHandler update %v", msgSend) + logger.Debugf("mgWebhookHandler update %+v", msgSend) } c.AbortWithStatus(http.StatusOK) @@ -677,7 +680,7 @@ func mgWebhookHandler(c *gin.Context) { } if config.Debug { - logger.Debugf("mgWebhookHandler delete %v", msgSend) + logger.Debugf("mgWebhookHandler delete %+v", msgSend) } c.JSON(http.StatusOK, gin.H{}) diff --git a/templates/layout.html b/templates/layout.html index a754b38..43c69fb 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -6,7 +6,7 @@ - +