Documentation ¶
Overview ¶
Package brev_ssh exists to provide an api to configure and read from an ssh file
brev ssh host file entry format:
Host <workspace-dns-name Hostname 0.0.0.0 IdentityFile /home//.brev/brev.pem User brev Port <some-available-port>
also think that file stuff should probably live in files package TODO migrate to using dns name for hostname
Index ¶
- func CreateBrevSSHConfigEntries(cfg ssh_config.Config, activeWorkspacesIdentifiers []string) (string, error)
- func GetBrevHostValues(cfg ssh_config.Config) []string
- func GetBrevPorts(cfg ssh_config.Config, hostnames []string) (map[string]bool, error)
- func GetSSHConfig(fs afero.Fs) (*ssh_config.Config, error)
- func PruneInactiveWorkspaces(cfg ssh_config.Config, activeWorkspacesNames []string) string
- type DefaultSSHConfigurer
- func (s *DefaultSSHConfigurer) Config() error
- func (s DefaultSSHConfigurer) GetConfiguredWorkspacePort(workspace brev_api.Workspace) (string, error)
- func (s DefaultSSHConfigurer) GetWorkspaces() ([]brev_api.WorkspaceWithMeta, error)
- func (s *DefaultSSHConfigurer) WithFS(fs afero.Fs) *DefaultSSHConfigurer
- type WorkspaceGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBrevSSHConfigEntries ¶
func CreateBrevSSHConfigEntries(cfg ssh_config.Config, activeWorkspacesIdentifiers []string) (string, error)
todo this should prob return a cfg object, instead make sure your re get the cfg after calling this
func GetBrevHostValues ¶
func GetBrevHostValues(cfg ssh_config.Config) []string
Hostname is a loaded term so using values
func GetBrevPorts ¶
func GetSSHConfig ¶
func GetSSHConfig(fs afero.Fs) (*ssh_config.Config, error)
func PruneInactiveWorkspaces ¶
func PruneInactiveWorkspaces(cfg ssh_config.Config, activeWorkspacesNames []string) string
Types ¶
type DefaultSSHConfigurer ¶
type DefaultSSHConfigurer struct {
// contains filtered or unexported fields
}
func NewDefaultSSHConfigurer ¶
func NewDefaultSSHConfigurer(workspaceGetter WorkspaceGetter, privateKey string) *DefaultSSHConfigurer
func (*DefaultSSHConfigurer) Config ¶
func (s *DefaultSSHConfigurer) Config() error
ConfigureSSH
[x] 0. writes private key to disk [x] 1. gets a list of the current user's workspaces [x] 2. finds the user's ssh config file, [x] 3. looks at entries in the ssh config file and: for each active workspace from brev delpoy create ssh config entry if it does not exist [x] 4. After creating the ssh config entries, prune entries from workspaces that exist in the ssh config but not as active workspaces. [ ] 5. Check for and remove duplicates? [x] 6. truncate old config and write new config back to disk (making backup of original copy first)
func (DefaultSSHConfigurer) GetConfiguredWorkspacePort ¶
func (s DefaultSSHConfigurer) GetConfiguredWorkspacePort(workspace brev_api.Workspace) (string, error)
func (DefaultSSHConfigurer) GetWorkspaces ¶
func (s DefaultSSHConfigurer) GetWorkspaces() ([]brev_api.WorkspaceWithMeta, error)
func (*DefaultSSHConfigurer) WithFS ¶
func (s *DefaultSSHConfigurer) WithFS(fs afero.Fs) *DefaultSSHConfigurer
type WorkspaceGetter ¶
Click to show internal directories.
Click to hide internal directories.