Support set environment for process manager
All checks were successful
release-nightly / build-docker (push) Successful in 1m10s

This commit is contained in:
LittleSheep 2023-12-16 21:12:45 +08:00
parent 47bc1c6aa1
commit 4942a8b7a2

View File

@ -11,6 +11,7 @@ type ProcessConfig struct {
ID string `json:"id" yaml:"id"` ID string `json:"id" yaml:"id"`
Workdir string `json:"workdir" yaml:"workdir"` Workdir string `json:"workdir" yaml:"workdir"`
Command []string `json:"command" yaml:"command"` Command []string `json:"command" yaml:"command"`
Environment []string `json:"environment" yaml:"environment"`
Prepares [][]string `json:"prepares" yaml:"prepares"` Prepares [][]string `json:"prepares" yaml:"prepares"`
Preheat bool `json:"preheat" yaml:"preheat"` Preheat bool `json:"preheat" yaml:"preheat"`
@ -63,6 +64,7 @@ func (v *ProcessConfig) StartProcess() error {
v.Cmd = exec.Command(v.Command[0], v.Command[1:]...) v.Cmd = exec.Command(v.Command[0], v.Command[1:]...)
v.Cmd.Dir = filepath.Join(v.Workdir) v.Cmd.Dir = filepath.Join(v.Workdir)
v.Cmd.Env = append(v.Cmd.Env, v.Environment...)
return v.Cmd.Start() return v.Cmd.Start()
} }