refactor: rename builders to server

This commit is contained in:
Mauricio Siu
2024-10-05 22:15:47 -06:00
parent 43555cdabe
commit f3ce69b656
361 changed files with 551 additions and 562 deletions

View File

@@ -0,0 +1,21 @@
import { docker } from "@/server/constants";
import { findServerById } from "@/server/services/server";
import Dockerode from "dockerode";
export const getRemoteDocker = async (serverId?: string | null) => {
if (!serverId) return docker;
const server = await findServerById(serverId);
if (!server.sshKeyId) return docker;
const dockerode = new Dockerode({
host: server.ipAddress,
port: server.port,
username: server.username,
protocol: "ssh",
// @ts-ignore
sshOptions: {
privateKey: server.sshKey?.privateKey,
},
});
return dockerode;
};