From d99a696ef0c1c13bbd15281670527be2cab7faf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20X=2E=20F=C3=BCrst?= Date: Thu, 4 Jun 2026 15:46:54 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20backup=20=E2=80=94=20MYSQL=5FPWD=20statt?= =?UTF-8?q?=20-p=20Flag,=20SSH-Key=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passwort via MYSQL_PWD-Env statt -p vermeidet die mysqldump-Warnung und ist sicherer. BACKUP_SSH_KEY_PATH ist jetzt optional: wenn leer, wird kein -i übergeben und SSH nutzt seine eigene Konfiguration (~/.ssh/config, ssh-agent). So funktionieren SSH-Config-Aliases (z.B. 'strato_1') ohne Key-Override. Co-Authored-By: Claude Sonnet 4.6 --- lib/backup.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/backup.ts b/lib/backup.ts index b05f59a..0923e6e 100644 --- a/lib/backup.ts +++ b/lib/backup.ts @@ -14,7 +14,7 @@ async function runBackup(): Promise { return; } const [, sshHost, remotePath] = match; - const rawKeyPath = process.env.BACKUP_SSH_KEY_PATH || '/app/.ssh/id_rsa'; + const rawKeyPath = process.env.BACKUP_SSH_KEY_PATH || ''; const keyPath = rawKeyPath.startsWith('~') ? rawKeyPath.replace('~', process.env.HOME || '/root') : rawKeyPath; @@ -29,17 +29,17 @@ async function runBackup(): Promise { const dbName = process.env.DB_NAME || 'sternwarte'; const sshOpts = [ - '-i', keyPath, + ...(keyPath ? ['-i', keyPath] : []), '-o', 'StrictHostKeyChecking=no', '-o', 'BatchMode=yes', ]; await new Promise((resolve, reject) => { const dump = spawn('mysqldump', [ - `-h${dbHost}`, `-P${dbPort}`, `-u${dbUser}`, `-p${dbPass}`, + `-h${dbHost}`, `-P${dbPort}`, `-u${dbUser}`, `--ignore-table=${dbName}.beos`, dbName, - ]); + ], { env: { ...process.env, MYSQL_PWD: dbPass } }); const gzip = spawn('gzip'); const ssh = spawn('ssh', [...sshOpts, sshHost, `cat > ${remotePath}/${filename}`]);