From e666466d272980cbbd882533c0d6ac59435e9be7 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Fri, 14 Mar 2025 14:38:06 +0100 Subject: [PATCH] fix: database name not set error when using flag -d (#183) * fix: database name not set error when using flag -d --- .github/workflows/tests.yml | 3 +-- pkg/config.go | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5a02c09..7b31daf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -182,8 +182,7 @@ jobs: -e DB_USERNAME=user \ -e DB_PASSWORD=password \ -e GPG_PASSPHRASE=password \ - -e DB_NAME=testdb \ - ${{ env.IMAGE_NAME }}:latest backup --disable-compression --custom-name encrypted-bkup + ${{ env.IMAGE_NAME }}:latest backup -d testdb --disable-compression --custom-name encrypted-bkup echo "Database encrypted backup completed" - name: Test restore encrypted backup | testdb -> testdb2 run: | diff --git a/pkg/config.go b/pkg/config.go index 19e8f3d..c6a40e7 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -251,6 +251,7 @@ func initBackupConfig(cmd *cobra.Command) *BackupConfig { utils.GetEnv(cmd, "cron-expression", "BACKUP_CRON_EXPRESSION") utils.GetEnv(cmd, "path", "REMOTE_PATH") utils.GetEnv(cmd, "config", "BACKUP_CONFIG_FILE") + utils.GetEnv(cmd, "dbname", "DB_NAME") // Get flag value and set env remotePath := utils.GetEnvVariable("REMOTE_PATH", "SSH_REMOTE_PATH") storage = utils.GetEnv(cmd, "storage", "STORAGE")