Pass session environment variables to command

This commit is contained in:
Trevor Slocum 2020-01-06 16:32:06 -08:00
parent d829810b8b
commit 6c5d6ee83e
3 changed files with 6 additions and 1 deletions

View File

@ -1,2 +1,5 @@
0.1.1:
- Pass session environment variables to command
0.1.0:
- Initial release

View File

@ -26,8 +26,9 @@ portals:
command: ps -aux
host:
- localhost:19003
- :19004 # Expose port 19004 to the internet
system monitor:
command: htop
host:
- localhost:19004
- localhost:19005
```

View File

@ -61,6 +61,7 @@ func NewPortal(name string, address string, command []string) (*Portal, error) {
}
cmd := exec.CommandContext(cmdCtx, command[0], args...)
cmd.Env = sshSession.Environ()
cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", ptyReq.Term))
f, err := pty.Start(cmd)