Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 918 Bytes

README.md

File metadata and controls

50 lines (36 loc) · 918 Bytes

get-ssh-config

Get Hosts From Local SSH Config File

Usage

  node ./dist/index.js

Or

import { getSSHConfig } from 'get-ssh-config';

const printHosts = () => {

  console.log(getSSHConfig());

}

printHosts();

Returns an array of "hosts" derived from the config file:

[
  {
     Host: [ 'staging' ],
     HostName: 'app1.test.matrix.com',
     User: 'keanu',
     IdentityFile: '~/.ssh/id_rsa',
  },
  {
     Host: [ 'prod' ],
     HostName: 'app1.prod.matrix.com',
     User: 'keanu',
     IdentityFile: '~/.ssh/id_rsa',
  }
]

The SSH Config File

This package assumes that you have a properly formatted file named config at ~/.ssh/config on your local machine.

See ssh.com/ssh/config and cyjake ssh-config for more information about formatting and parsing the config file.