Skip to content

edezekiel/get-ssh-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Get Hosts From Local SSH Config File

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published