()
| 249 | } |
| 250 | |
| 251 | async function loadSSHConfig(): Promise<SSHConfig | null> { |
| 252 | const homeDir = getHomeDir(); |
| 253 | const configPath = path.join(homeDir, ".ssh", "config"); |
| 254 | |
| 255 | try { |
| 256 | const content = await fs.readFile(configPath, "utf8"); |
| 257 | const parsed = SSHConfig.parse(content); |
| 258 | return parsed; |
| 259 | } catch (error) { |
| 260 | if ((error as NodeJS.ErrnoException | undefined)?.code !== "ENOENT") { |
| 261 | log.debug("Failed to read SSH config", { |
| 262 | configPath, |
| 263 | error: getErrorMessage(error), |
| 264 | }); |
| 265 | } |
| 266 | return null; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | export async function resolveSSHConfig(host: string): Promise<ResolvedSSHConfig> { |
| 271 | const { host: hostAlias, user: userOverride } = parseHostAndUser(host); |
no test coverage detected