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

Function getBaseFilesPath

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

Source from the content-addressed store, hash-verified

346};
347
348export const getBaseFilesPath = async (mountId: string) => {
349 const mount = await findMountById(mountId);
350
351 let absoluteBasePath = "";
352 let appName = "";
353 let directoryPath = "";
354
355 if (mount.serviceType === "application" && mount.application) {
356 const { APPLICATIONS_PATH } = paths(!!mount.application.serverId);
357 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
358 appName = mount.application.appName;
359 } else if (mount.serviceType === "postgres" && mount.postgres) {
360 const { APPLICATIONS_PATH } = paths(!!mount.postgres.serverId);
361 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
362 appName = mount.postgres.appName;
363 } else if (mount.serviceType === "mariadb" && mount.mariadb) {
364 const { APPLICATIONS_PATH } = paths(!!mount.mariadb.serverId);
365 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
366 appName = mount.mariadb.appName;
367 } else if (mount.serviceType === "mongo" && mount.mongo) {
368 const { APPLICATIONS_PATH } = paths(!!mount.mongo.serverId);
369 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
370 appName = mount.mongo.appName;
371 } else if (mount.serviceType === "mysql" && mount.mysql) {
372 const { APPLICATIONS_PATH } = paths(!!mount.mysql.serverId);
373 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
374 appName = mount.mysql.appName;
375 } else if (mount.serviceType === "redis" && mount.redis) {
376 const { APPLICATIONS_PATH } = paths(!!mount.redis.serverId);
377 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
378 appName = mount.redis.appName;
379 } else if (mount.serviceType === "compose" && mount.compose) {
380 const { COMPOSE_PATH } = paths(!!mount.compose.serverId);
381 appName = mount.compose.appName;
382 absoluteBasePath = path.resolve(COMPOSE_PATH);
383 } else if (mount.serviceType === "libsql" && mount.libsql) {
384 const { APPLICATIONS_PATH } = paths(!!mount.libsql.serverId);
385 absoluteBasePath = path.resolve(APPLICATIONS_PATH);
386 appName = mount.libsql.appName;
387 }
388 directoryPath = path.join(absoluteBasePath, appName, "files");
389
390 return directoryPath;
391};
392
393type MountNested = Awaited<ReturnType<typeof findMountById>>;
394export const getServerId = async (mount: MountNested) => {

Callers 3

createFileMountFunction · 0.85
updateFileMountFunction · 0.85
deleteFileMountFunction · 0.85

Calls 2

pathsFunction · 0.90
findMountByIdFunction · 0.85

Tested by

no test coverage detected