File tree Expand file tree Collapse file tree 5 files changed +10
-0
lines changed
Expand file tree Collapse file tree 5 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ build_target_path : ""
7676binary_name : refresh-build
7777# any extra commands you want to send to the built binary when it is run:
7878command_flags : []
79+ # any extra environment variables you want to send to the built binary when it is run:
80+ command_env : []
7981# do you want to use colors when printing out log messages:
8082enable_colors : true
8183` ` `
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ var initCmd = &cobra.Command{
2424 BuildDelay : 200 ,
2525 BinaryName : "refresh-build" ,
2626 CommandFlags : []string {},
27+ CommandEnv : []string {},
2728 EnableColors : true ,
2829 }
2930 c .Dump (cfgFile )
Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ build_path: /tmp
99build_delay : 200ns
1010binary_name : refresh-build
1111command_flags : []
12+ command_env : []
1213enable_colors : true
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ type Configuration struct {
2222 BuildDelay time.Duration `yaml:"build_delay"`
2323 BinaryName string `yaml:"binary_name"`
2424 CommandFlags []string `yaml:"command_flags"`
25+ CommandEnv []string `yaml:"command_env"`
2526 EnableColors bool `yaml:"enable_colors"`
2627 LogName string `yaml:"log_name"`
2728}
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ func (m *Manager) runAndListen(cmd *exec.Cmd) error {
3636 cmd .Stdin = os .Stdin
3737 cmd .Stdout = os .Stdout
3838
39+ // Set the environment variables from config
40+ if len (m .CommandEnv ) != 0 {
41+ cmd .Env = append (m .CommandEnv , os .Environ ()... )
42+ }
43+
3944 err := cmd .Start ()
4045 if err != nil {
4146 return fmt .Errorf ("%s\n %s" , err , stderr .String ())
You can’t perform that action at this time.
0 commit comments