(serverId?: string | null)
| 3 | import Dockerode from "dockerode"; |
| 4 | |
| 5 | export const getRemoteDocker = async (serverId?: string | null) => { |
| 6 | if (!serverId) return docker; |
| 7 | const server = await findServerById(serverId); |
| 8 | if (!server.sshKeyId) return docker; |
| 9 | const dockerode = new Dockerode({ |
| 10 | host: server.ipAddress, |
| 11 | port: server.port, |
| 12 | username: server.username, |
| 13 | protocol: "ssh", |
| 14 | // @ts-ignore |
| 15 | sshOptions: { |
| 16 | privateKey: server.sshKey?.privateKey, |
| 17 | }, |
| 18 | }); |
| 19 | |
| 20 | return dockerode; |
| 21 | }; |
no test coverage detected