(host, remotePort)
| 25 | }; |
| 26 | |
| 27 | const updateKnownHosts = (host, remotePort) => { |
| 28 | const { knownHostsPath } = getPrivateKeyPath(); |
| 29 | console.log('[SSH] Adding host to `known_hosts` ....', host, knownHostsPath); |
| 30 | try { |
| 31 | execSync(`ssh-keyscan -p ${(remotePort || 22)} -H ${host} >> ${knownHostsPath}`, { |
| 32 | stdio: 'inherit' |
| 33 | }); |
| 34 | } catch (error) { |
| 35 | console.error('❌ [SSH] Adding host to `known_hosts` ERROR', host, error.message); |
| 36 | } |
| 37 | console.log('✅ [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath); |
| 38 | }; |
| 39 | |
| 40 | module.exports = { |
| 41 | getPrivateKeyPath, |
no test coverage detected