1
0

fix: the dump script to support dockerized DB

This commit is contained in:
alikia2x (寒寒) 2026-01-17 21:50:48 +08:00
parent d959f8851d
commit 9d235eb51b
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 56209E0CCD8420C6
2 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@ const ENDPOINT = env.BACKUP_S3_ENDPOINT;
const REGION = env.BACKUP_S3_REGION;
const BUCKET = env.BACKUP_S3_BUCKET;
const DIR = env.BACKUP_DIR;
const CONTAINER = env.BACKUP_CONTAINER;
const CONFIG = {
localBackupDir: DIR,
@ -42,7 +43,7 @@ const getMonthStr = (): string => {
};
async function dump(filePath: string) {
await $`pg_dump -d ${dbUri} -Fc -n public > ${filePath}`;
await $`docker exec -u postgres ${CONTAINER} pg_dump -d ${dbUri} -Fc -n public > ${filePath}`;
}
async function runBackup() {

View File

@ -9,6 +9,7 @@ export const env = createEnv({
BACKUP_S3_ENDPOINT: z.string(),
BACKUP_S3_REGION: z.string(),
OSS_ACCESS_KEY_ID: z.string(),
OSS_ACCESS_KEY_SECRET: z.string(),
OSS_ACCESS_KEY_SECRET: z.string(),
BACKUP_CONTAINER: z.string(),
},
});