MCPcopy
hub / github.com/Dokploy/dokploy / createFileMount

Function createFileMount

packages/server/src/services/mount.ts:81–106  ·  view source on GitHub ↗
(mountId: string)

Source from the content-addressed store, hash-verified

79};
80
81export const createFileMount = async (mountId: string) => {
82 try {
83 const mount = await findMountById(mountId);
84 const baseFilePath = await getBaseFilesPath(mountId);
85
86 const serverId = await getServerId(mount);
87
88 if (serverId) {
89 const command = getCreateFileCommand(
90 baseFilePath,
91 mount.filePath || "",
92 mount.content || "",
93 );
94 await execAsyncRemote(serverId, command);
95 } else {
96 await createFile(baseFilePath, mount.filePath || "", mount.content || "");
97 }
98 } catch (error) {
99 console.log(`Error creating the file mount: ${error}`);
100 throw new TRPCError({
101 code: "BAD_REQUEST",
102 message: `Error creating the mount ${error instanceof Error ? error.message : error}`,
103 cause: error,
104 });
105 }
106};
107
108export const findMountById = async (mountId: string) => {
109 const mount = await db.query.mounts.findFirst({

Callers 1

createMountFunction · 0.85

Calls 6

getCreateFileCommandFunction · 0.90
execAsyncRemoteFunction · 0.90
createFileFunction · 0.90
findMountByIdFunction · 0.85
getBaseFilesPathFunction · 0.85
getServerIdFunction · 0.85

Tested by

no test coverage detected