Skip to content

Commit

Permalink
Remove ssh config bug introduced in pull request #69 while another so…
Browse files Browse the repository at this point in the history
…lution is found.
  • Loading branch information
Natizyskunk committed Nov 20, 2021
1 parent 4e998e5 commit ca6519e
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/core/fileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,41 @@ function mergeConfigWithExternalRefer(
}

const parsedSSHConfig = sshConfig.parse(sshConfigContent);
const section = parsedSSHConfig.find({
Host: copyed.host,
});

if (section === null) {
return copyed;
}

const mapping = new Map([
['hostname', 'host'],
['port', 'port'],
['user', 'username'],
['identityfile', 'privateKeyPath'],
['serveraliveinterval', 'keepalive'],
['connecttimeout', 'connTimeout'],
]);

section.config.forEach(line => {
if (!line.param) {
return;
}

const key = mapping.get(line.param.toLowerCase());

if (key !== undefined) {
if (key === 'host') {
copyed[key] = line.value;
} else {
setConfigValue(copyed, key, line.value);
}
}
});

// Bug introduced in pull request #69 : Fix ssh config resolution
/* const parsedSSHConfig = sshConfig.parse(sshConfigContent);
const computed = parsedSSHConfig.compute(copyed.host);
const mapping = new Map([
Expand All @@ -259,7 +294,7 @@ function mergeConfigWithExternalRefer(
setConfigValue(copyed, key, value);
}
}
});
}); */

return copyed;
}
Expand Down

0 comments on commit ca6519e

Please sign in to comment.