Skip to content

Commit

Permalink
read the bastion addr from env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 committed Oct 21, 2024
1 parent 557af51 commit 232eb2a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/admin_k9s.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,27 @@ func checkEnv() {
os.Exit(1)
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

if _, ok := os.LookupEnv("BASTION_ADDR"); !ok {
log.Error("You must set the bastion address (BASTION_ADDR).")
os.Exit(1)
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}
}

func setupSSHConnection(ctx context.Context) (*exec.Cmd, error) {
bastionAddress, ok := os.LookupEnv("BASTION_ADDR")
if !ok {
log.Error("You must set the bastion address (BASTION_ADDR).")
os.Exit(1)
}

sshArgs := []string{
"-N", "-D", "1080",
"-o", "ServerAliveInterval=10",
"-o", "ServerAliveCountMax=3",
"-o", "TCPKeepAlive=yes",
"root@bastion.z6d9f665a.rustrocks.space",
fmt.Sprintf("root@%s", bastionAddress),
"-p", "2222",
}

Expand Down

0 comments on commit 232eb2a

Please sign in to comment.