From 6c5d6ee83ee9b0fd1410073f25d44047946e1d7c Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Mon, 6 Jan 2020 16:32:06 -0800 Subject: [PATCH] Pass session environment variables to command --- CHANGELOG | 3 +++ CONFIGURATION.md | 3 ++- pkg/gate/portal.go | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 8da6a6f..3e9bbea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,2 +1,5 @@ +0.1.1: +- Pass session environment variables to command + 0.1.0: - Initial release diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 48e129b..dcdde14 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -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 ``` diff --git a/pkg/gate/portal.go b/pkg/gate/portal.go index 0046d09..95234e4 100644 --- a/pkg/gate/portal.go +++ b/pkg/gate/portal.go @@ -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)