SSH info in connection refactor - do not save default values

This commit is contained in:
Jan Prochazka
2024-07-10 16:29:05 +02:00
parent cb0a11fda9
commit 8f0b44ade9
5 changed files with 26 additions and 12 deletions

View File

@@ -15,10 +15,12 @@ async function getSshConnection(connection) {
agentForward: connection.sshMode == 'agent',
passphrase: connection.sshMode == 'keyFile' ? connection.sshKeyfilePassword : undefined,
username: connection.sshLogin,
password: connection.sshMode == 'userPassword' ? connection.sshPassword : undefined,
password: (connection.sshMode || 'userPassword') == 'userPassword' ? connection.sshPassword : undefined,
agentSocket: connection.sshMode == 'agent' ? platformInfo.sshAuthSock : undefined,
privateKey:
connection.sshMode == 'keyFile' && connection.sshKeyfile ? await fs.readFile(connection.sshKeyfile) : undefined,
connection.sshMode == 'keyFile' && (connection.sshKeyfile || platformInfo?.defaultKeyfile)
? await fs.readFile(connection.sshKeyfile || platformInfo?.defaultKeyfile)
: undefined,
skipAutoPrivateKey: true,
noReadline: true,
};