Skip to content

Commit 10d6d02

Browse files
committed
fix: mongorestore argv
1 parent aca74fc commit 10d6d02

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/modules/backup/backup.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export class BackupService {
8585
try {
8686
cd(tempDirPath)
8787
await $`unzip backup.zip`
88-
await $`mongorestore -h ${process.env.DB_URL || '127.0.0.1'} -d ${
89-
MONGO_DB.collectionName
90-
} ./mx-space --drop >/dev/null 2>&1`
88+
await $`mongorestore -h ${MONGO_DB.host || '127.0.0.1'} --port ${
89+
MONGO_DB.port || 27017
90+
} -d ${MONGO_DB.collectionName} ./mx-space --drop >/dev/null 2>&1`
9191

9292
this.logger.debug('恢复成功')
9393
await this.adminGateway.broadcast(
@@ -118,9 +118,9 @@ export class BackupService {
118118
}
119119

120120
cd(dirPath)
121-
await $`mongorestore -h ${process.env.DB_URL || '127.0.0.1'} -d ${
122-
MONGO_DB.collectionName
123-
} ./mx-space --drop >/dev/null 2>&1`
121+
await $`mongorestore -h ${MONGO_DB.host || '127.0.0.1'} --port ${
122+
MONGO_DB.port || 27017
123+
} -d ${MONGO_DB.collectionName} ./mx-space --drop >/dev/null 2>&1`
124124
} catch (e) {
125125
this.logger.error(e)
126126
throw e

0 commit comments

Comments
 (0)