Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FEATURE (notifiers): Change testing notifier from Telegram to webhook

Rostislav Dugina17ea2f3e21c
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
index ff6c0c94..a30d072a 100644
--- a/.github/workflows/ci-release.yml
+++ b/.github/workflows/ci-release.yml
@@ -304,9 +304,6 @@ jobs:
TEST_MARIADB_114_PORT=33114
TEST_MARIADB_118_PORT=33118
TEST_MARIADB_120_PORT=33120
- # testing Telegram
- TEST_TELEGRAM_BOT_TOKEN=${{ secrets.TEST_TELEGRAM_BOT_TOKEN }}
- TEST_TELEGRAM_CHAT_ID=${{ secrets.TEST_TELEGRAM_CHAT_ID }}
# supabase
TEST_SUPABASE_HOST=${{ secrets.TEST_SUPABASE_HOST }}
TEST_SUPABASE_PORT=${{ secrets.TEST_SUPABASE_PORT }}
diff --git a/backend/.env.development.example b/backend/.env.development.example
index df9e4243..94f49ef3 100644
--- a/backend/.env.development.example
+++ b/backend/.env.development.example
@@ -45,9 +45,6 @@ TEST_MINIO_PORT=9000
TEST_MINIO_CONSOLE_PORT=9001
# testing NAS
TEST_NAS_PORT=7006
-# testing Telegram
-TEST_TELEGRAM_BOT_TOKEN=
-TEST_TELEGRAM_CHAT_ID=
# testing Azure Blob Storage
TEST_AZURITE_BLOB_PORT=10000
# supabase
diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go
index 3ca4a066..9b9600df 100644
--- a/backend/internal/config/config.go
+++ b/backend/internal/config/config.go
@@ -109,10 +109,6 @@ type EnvVariables struct {
CloudflareTurnstileSecretKey string `env:"CLOUDFLARE_TURNSTILE_SECRET_KEY"`
CloudflareTurnstileSiteKey string `env:"CLOUDFLARE_TURNSTILE_SITE_KEY"`
- // testing Telegram
- TestTelegramBotToken string `env:"TEST_TELEGRAM_BOT_TOKEN"`
- TestTelegramChatID string `env:"TEST_TELEGRAM_CHAT_ID"`
-
// testing Supabase
TestSupabaseHost string `env:"TEST_SUPABASE_HOST"`
TestSupabasePort string `env:"TEST_SUPABASE_PORT"`
@@ -365,15 +361,6 @@ func loadEnvVariables() {
os.Exit(1)
}
- if env.TestTelegramBotToken == "" {
- log.Error("TEST_TELEGRAM_BOT_TOKEN is empty")
- os.Exit(1)
- }
-
- if env.TestTelegramChatID == "" {
- log.Error("TEST_TELEGRAM_CHAT_ID is empty")
- os.Exit(1)
- }
}
log.Info("Environment variables loaded successfully!")
diff --git a/backend/internal/features/notifiers/controller_test.go b/backend/internal/features/notifiers/controller_test.go
index 36c03733..964616ad 100644
--- a/backend/internal/features/notifiers/controller_test.go
+++ b/backend/internal/features/notifiers/controller_test.go
@@ -9,7 +9,6 @@ import (
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
- "databasus-backend/internal/config"
audit_logs "databasus-backend/internal/features/audit_logs"
discord_notifier "databasus-backend/internal/features/notifiers/models/discord"
email_notifier "databasus-backend/internal/features/notifiers/models/email_notifier"
@@ -159,7 +158,7 @@ func Test_SendTestNotificationDirect_NotificationSent(t *testing.T) {
router := createRouter()
workspace := workspaces_testing.CreateTestWorkspace("Test Workspace", owner, router)
- notifier := createTelegramNotifier(workspace.ID)
+ notifier := createWebhookNotifier(workspace.ID)
response := test_utils.MakePostRequest(
t, router, "/api/v1/notifiers/direct-test", "Bearer "+owner.Token, *notifier, http.StatusOK,
@@ -174,7 +173,7 @@ func Test_SendTestNotificationExisting_NotificationSent(t *testing.T) {
router := createRouter()
workspace := workspaces_testing.CreateTestWorkspace("Test Workspace", owner, router)
- notifier := createTelegramNotifier(workspace.ID)
+ notifier := createWebhookNotifier(workspace.ID)
var savedNotifier Notifier
test_utils.MakePostRequestAndUnmarshal(
@@ -1252,15 +1251,14 @@ func createNewNotifier(workspaceID uuid.UUID) *Notifier {
}
}
-func createTelegramNotifier(workspaceID uuid.UUID) *Notifier {
- env := config.GetEnv()
+func createWebhookNotifier(workspaceID uuid.UUID) *Notifier {
return &Notifier{
WorkspaceID: workspaceID,
- Name: "Test Telegram Notifier " + uuid.New().String(),
- NotifierType: NotifierTypeTelegram,
- TelegramNotifier: &telegram_notifier.TelegramNotifier{
- BotToken: env.TestTelegramBotToken,
- TargetChatID: env.TestTelegramChatID,
+ Name: "Test Webhook Notifier " + uuid.New().String(),
+ NotifierType: NotifierTypeWebhook,
+ WebhookNotifier: &webhook_notifier.WebhookNotifier{
+ WebhookURL: "https://databasus.com",
+ WebhookMethod: webhook_notifier.WebhookMethodGET,
},
}
}