MCPcopy Index your code
hub / github.com/coder/mux / loadSSHConfig

Function loadSSHConfig

src/node/runtime/sshConfigParser.ts:251–268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249}
250
251async 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
270export async function resolveSSHConfig(host: string): Promise<ResolvedSSHConfig> {
271 const { host: hostAlias, user: userOverride } = parseHostAndUser(host);

Callers 1

resolveSSHConfigFunction · 0.85

Calls 5

getErrorMessageFunction · 0.90
debugMethod · 0.80
getHomeDirFunction · 0.70
readFileMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected