Skip to content

Commit daedd92

Browse files
committed
settings: support ENV
1 parent c798730 commit daedd92

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

agent/agent.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package agent
33
import (
44
"fmt"
55
"github.com/garyburd/redigo/redis"
6+
"os"
67
"os/exec"
78
"strings"
89
)
@@ -58,7 +59,9 @@ func SaveTwemproxyConfig() {
5859
func 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))

agent/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)