fix: mongorestore argv

This commit is contained in:
Innei
2021-10-01 20:34:15 +08:00
parent aca74fcf43
commit 10d6d0219f

View File

@@ -85,9 +85,9 @@ export class BackupService {
try {
cd(tempDirPath)
await $`unzip backup.zip`
await $`mongorestore -h ${process.env.DB_URL || '127.0.0.1'} -d ${
MONGO_DB.collectionName
} ./mx-space --drop >/dev/null 2>&1`
await $`mongorestore -h ${MONGO_DB.host || '127.0.0.1'} --port ${
MONGO_DB.port || 27017
} -d ${MONGO_DB.collectionName} ./mx-space --drop >/dev/null 2>&1`
this.logger.debug('恢复成功')
await this.adminGateway.broadcast(
@@ -118,9 +118,9 @@ export class BackupService {
}
cd(dirPath)
await $`mongorestore -h ${process.env.DB_URL || '127.0.0.1'} -d ${
MONGO_DB.collectionName
} ./mx-space --drop >/dev/null 2>&1`
await $`mongorestore -h ${MONGO_DB.host || '127.0.0.1'} --port ${
MONGO_DB.port || 27017
} -d ${MONGO_DB.collectionName} ./mx-space --drop >/dev/null 2>&1`
} catch (e) {
this.logger.error(e)
throw e