Function
getMongoSpecificCommand
(
rcloneCommand: string,
restoreCommand: string,
backupFile: string,
)
Source from the content-addressed store, hash-verified
| 76 | }; |
| 77 | |
| 78 | const getMongoSpecificCommand = ( |
| 79 | rcloneCommand: string, |
| 80 | restoreCommand: string, |
| 81 | backupFile: string, |
| 82 | ): string => { |
| 83 | const tempDir = "/tmp/dokploy-restore"; |
| 84 | const fileName = backupFile.split("/").pop() || "backup.sql.gz"; |
| 85 | const decompressedName = fileName.replace(".gz", ""); |
| 86 | return ` |
| 87 | rm -rf ${tempDir} && \ |
| 88 | mkdir -p ${tempDir} && \ |
| 89 | ${rcloneCommand} ${tempDir} && \ |
| 90 | cd ${tempDir} && \ |
| 91 | gunzip -f "${fileName}" && \ |
| 92 | ${restoreCommand} < "${decompressedName}" && \ |
| 93 | rm -rf ${tempDir} |
| 94 | `; |
| 95 | }; |
| 96 | |
| 97 | interface RestoreOptions { |
| 98 | appName: string; |
Tested by
no test coverage detected