Skip to content

Commit b090a2a

Browse files
authored
fix: propagate env vars to child processes
Propagates environment variables when starting and stopping child processes by appending instead of overwriting them. Fixes: #168, #169
1 parent 9963ae1 commit b090a2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

proxy/process.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (p *Process) start() error {
193193
p.cmd = exec.CommandContext(cmdContext, args[0], args[1:]...)
194194
p.cmd.Stdout = p.processLogger
195195
p.cmd.Stderr = p.processLogger
196-
p.cmd.Env = p.config.Env
196+
p.cmd.Env = append(p.cmd.Environ(), p.config.Env...)
197197

198198
p.cmd.Cancel = p.cmdStopUpstreamProcess
199199
p.cmd.WaitDelay = p.gracefulStopTimeout
@@ -531,7 +531,7 @@ func (p *Process) cmdStopUpstreamProcess() error {
531531
stopCmd := exec.Command(stopArgs[0], stopArgs[1:]...)
532532
stopCmd.Stdout = p.processLogger
533533
stopCmd.Stderr = p.processLogger
534-
stopCmd.Env = p.config.Env
534+
stopCmd.Env = append(stopCmd.Environ(), p.config.Env...)
535535

536536
if err := stopCmd.Run(); err != nil {
537537
p.proxyLogger.Errorf("<%s> Failed to exec stop command: %v", p.ID, err)

0 commit comments

Comments
 (0)