Support multiline cmds in YAML configuration

Add support for multiline `cmd` configurations allowing for nicer looking configuration YAML files.
This commit is contained in:
Benson Wong
2024-10-19 20:06:59 -07:00
parent 6cf0962807
commit be82d1a6a0
6 changed files with 185 additions and 18 deletions

View File

@@ -65,13 +65,16 @@ func (pm *ProxyManager) swapModel(requestedModel string) error {
pm.currentConfig = modelConfig
args := strings.Fields(modelConfig.Cmd)
args, err := modelConfig.SanitizedCommand()
if err != nil {
return fmt.Errorf("unable to get sanitized command: %v", err)
}
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Env = modelConfig.Env
err := cmd.Start()
err = cmd.Start()
if err != nil {
return err
}