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

Function getSFTPConnection

packages/server/src/utils/builders/drop.ts:110–130  ·  view source on GitHub ↗
(serverId: string)

Source from the content-addressed store, hash-verified

108};
109
110const getSFTPConnection = async (serverId: string): Promise<SFTPWrapper> => {
111 const server = await findServerById(serverId);
112 if (!server.sshKeyId) throw new Error("No SSH key available for this server");
113
114 return new Promise((resolve, reject) => {
115 const conn = new Client();
116 conn
117 .on("ready", () => {
118 conn.sftp((err, sftp) => {
119 if (err) return reject(err);
120 resolve(sftp);
121 });
122 })
123 .connect({
124 host: server.ipAddress,
125 port: server.port,
126 username: server.username,
127 privateKey: server.sshKey?.privateKey,
128 });
129 });
130};
131
132const uploadFileToServer = (
133 sftp: SFTPWrapper,

Callers 1

unzipDropFunction · 0.85

Calls 1

findServerByIdFunction · 0.90

Tested by

no test coverage detected