feat: generate key pair using ssh2 for right public key format

This commit is contained in:
Justin Lin committed 2024-10-14 11:34:53 +08:00
1 parent 03b2993b56
commit 261c6fc029
6 files changed
+20 -15

No files matched your search

+2 -2
View File
@@ -1,4 +1,3 @@
import fs from 'fs'
import { Duplex } from 'stream'
import { Client } from 'ssh2'
import Docker from 'dockerode'
@@ -67,6 +66,7 @@ export async function attachContainer(
config.docker.network
].IPAddress
const conn = new Client()
console.log(config.docker.keypair.privateKey)
return new Promise((resolve, reject) => {
conn
@@ -100,7 +100,7 @@ export async function attachContainer(
host: containerIp,
port: 22,
username: 'commander',
privateKey: fs.readFileSync('/home/wancat/.ssh/id_ed25519'),
privateKey: config.docker.keypair.privateKey,
debug: console.log,
})
})