mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 00:50:23 -05:00
fix(server): allow starting backup through API and fix pg_dumpall args when using database URLs (#13970)
* fix(server): allow starting backup through API * fix(server): fix pg_dumpall args when using database URLs The database has to be specified using `-d`, unlike for pg_dump.
This commit is contained in:
parent
be2b76be8c
commit
f4741c70f3
2 changed files with 5 additions and 1 deletions
|
@ -85,7 +85,7 @@ export class BackupService extends BaseService {
|
||||||
} = this.configRepository.getEnv();
|
} = this.configRepository.getEnv();
|
||||||
|
|
||||||
const isUrlConnection = config.connectionType === 'url';
|
const isUrlConnection = config.connectionType === 'url';
|
||||||
const databaseParams = isUrlConnection ? [config.url] : ['-U', config.username, '-h', config.host];
|
const databaseParams = isUrlConnection ? ['-d', config.url] : ['-U', config.username, '-h', config.host];
|
||||||
const backupFilePath = path.join(
|
const backupFilePath = path.join(
|
||||||
StorageCore.getBaseFolder(StorageFolder.BACKUPS),
|
StorageCore.getBaseFolder(StorageFolder.BACKUPS),
|
||||||
`immich-db-backup-${Date.now()}.sql.gz.tmp`,
|
`immich-db-backup-${Date.now()}.sql.gz.tmp`,
|
||||||
|
|
|
@ -164,6 +164,10 @@ export class JobService extends BaseService {
|
||||||
return this.jobRepository.queue({ name: JobName.LIBRARY_QUEUE_SYNC_ALL, data: { force } });
|
return this.jobRepository.queue({ name: JobName.LIBRARY_QUEUE_SYNC_ALL, data: { force } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case QueueName.BACKUP_DATABASE: {
|
||||||
|
return this.jobRepository.queue({ name: JobName.BACKUP_DATABASE, data: { force } });
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
throw new BadRequestException(`Invalid job name: ${name}`);
|
throw new BadRequestException(`Invalid job name: ${name}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue