( appName: string, service: | ApplicationNested | LibsqlNested | MongoNested | MariadbNested | MysqlNested | PostgresNested | RedisNested, )
| 652 | }; |
| 653 | |
| 654 | export const generateFileMounts = ( |
| 655 | appName: string, |
| 656 | service: |
| 657 | | ApplicationNested |
| 658 | | LibsqlNested |
| 659 | | MongoNested |
| 660 | | MariadbNested |
| 661 | | MysqlNested |
| 662 | | PostgresNested |
| 663 | | RedisNested, |
| 664 | ) => { |
| 665 | const { mounts } = service; |
| 666 | const { APPLICATIONS_PATH } = paths(!!service.serverId); |
| 667 | if (!mounts || mounts.length === 0) { |
| 668 | return []; |
| 669 | } |
| 670 | |
| 671 | return mounts |
| 672 | .filter((mount) => mount.type === "file") |
| 673 | .map((mount) => { |
| 674 | const fileName = mount.filePath; |
| 675 | const absoluteBasePath = path.resolve(APPLICATIONS_PATH); |
| 676 | const directory = path.join(absoluteBasePath, appName, "files"); |
| 677 | const sourcePath = path.join(directory, fileName || ""); |
| 678 | return { |
| 679 | Type: "bind" as const, |
| 680 | Source: sourcePath, |
| 681 | Target: mount.mountPath, |
| 682 | }; |
| 683 | }); |
| 684 | }; |
| 685 | |
| 686 | export const createFile = async ( |
| 687 | outputPath: string, |
no test coverage detected