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

Function readPatchRepoFile

packages/server/src/services/patch-repo.ts:147–180  ·  view source on GitHub ↗
(
	id: string,
	type: "application" | "compose",
	filePath: string,
)

Source from the content-addressed store, hash-verified

145};
146
147export const readPatchRepoFile = async (
148 id: string,
149 type: "application" | "compose",
150 filePath: string,
151) => {
152 let serverId: string | null = null;
153
154 if (type === "application") {
155 const application = await findApplicationById(id);
156 serverId = application.buildServerId || application.serverId;
157 } else {
158 const compose = await findComposeById(id);
159 serverId = compose.serverId;
160 }
161 const { PATCH_REPOS_PATH } = paths(!!serverId);
162
163 const application =
164 type === "application"
165 ? await findApplicationById(id)
166 : await findComposeById(id);
167
168 const repoPath = join(PATCH_REPOS_PATH, type, application.appName);
169 const fullPath = join(repoPath, filePath);
170
171 const command = `cat "${fullPath}"`;
172
173 if (serverId) {
174 const result = await execAsyncRemote(serverId, command);
175 return result.stdout;
176 }
177
178 const result = await execAsync(command);
179 return result.stdout;
180};
181
182/**
183 * Clean all patch repos

Callers 1

patch.tsFile · 0.90

Calls 5

findApplicationByIdFunction · 0.90
findComposeByIdFunction · 0.90
pathsFunction · 0.90
execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90

Tested by

no test coverage detected