Skip to content

Commit

Permalink
Add suffix to hostname ip addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Hills authored and ekini committed Jul 22, 2019
1 parent f6656bc commit 07f5d1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/reconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import (
)

type SSHEntry struct {
Profile,
Name,
Address,
ProxyJump string
}

func (e SSHEntry) ConfigFormat() string {
var output = []string{
fmt.Sprintf("Host %s %s", e.Name, e.Address),
fmt.Sprintf("Host %s %s.%s", e.Name, e.Address, e.Profile),
}
if e.ProxyJump != "" {
output = append(output, fmt.Sprintf(" ProxyJump %s", e.ProxyJump))
Expand Down Expand Up @@ -103,7 +104,7 @@ func Reconf(profiles []string, filename string) {

for n, instance := range nameGroup.Group {
instance := instance.(*ec2.Instance)
var entry = SSHEntry{Name: getInstanceCanonicalName(summary.Name, instanceName, fmt.Sprintf("%d", n+1))}
var entry = SSHEntry{Name: getInstanceCanonicalName(summary.Name, instanceName, fmt.Sprintf("%d", n+1)), Profile: summary.Name}

// first try to find a bastion from this vpc
bastion := findBestBastion(instanceName, vpcBastions)
Expand Down

0 comments on commit 07f5d1c

Please sign in to comment.