File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package agent
33import (
44 "fmt"
55 "github.com/garyburd/redigo/redis"
6+ "os"
67 "os/exec"
78 "strings"
89)
@@ -58,7 +59,9 @@ func SaveTwemproxyConfig() {
5859func RestartTwemproxy () error {
5960 Debug ("Restarting Twemproxy." )
6061 args := strings .Split (Settings .RestartArgs , string (' ' ))
61- out , err := exec .Command (Settings .RestartCommand , args ... ).Output ()
62+ cmd := exec .Command (Settings .RestartCommand , args ... )
63+ cmd .Env = append (os .Environ (), Settings .RestartEnv )
64+ out , err := cmd .Output ()
6265
6366 if err != nil {
6467 Debug (fmt .Sprintf ("Cannot restart twemproxy. output: %s. error: %s" , out , err ))
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type AgentSettings struct {
1313 Sentinels []string `yaml:"sentinels"`
1414 RestartCommand string `yaml:"restart_command"`
1515 RestartArgs string `yaml:"restart_args"`
16+ RestartEnv string `yaml:"restart_env"`
1617 LogFile string `yaml:"log_file"`
1718}
1819
You can’t perform that action at this time.
0 commit comments