diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index b6af4f6dc..068f8ab9e 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -18,14 +18,35 @@ func canScaleApp(appName string) bool { return common.ToBool(canScale) } -func getProcfileCommand(procfilePath string, processType string, port int) (string, error) { +func getProcfileCommand(appName string, procfilePath string, processType string, port int) (string, error) { if !common.FileExists(procfilePath) { return "", errors.New("No procfile found") } + configResult, err := common.CallPlugnTrigger(common.PlugnTriggerInput{ + Trigger: "config-export", + Args: []string{appName, "false", "true", "envfile"}, + }) + if err != nil { + return "", err + } + + // write the envfile to a temporary file + tempFile, err := os.CreateTemp("", "envfile-*.env") + if err != nil { + return "", err + } + defer os.Remove(tempFile.Name()) + if _, err := tempFile.Write(configResult.StdoutBytes()); err != nil { + return "", err + } + if err := tempFile.Close(); err != nil { + return "", err + } + result, err := common.CallExecCommand(common.ExecCommandInput{ Command: "procfile-util", - Args: []string{"show", "--procfile", procfilePath, "--process-type", processType, "--default-port", strconv.Itoa(port)}, + Args: []string{"show", "--procfile", procfilePath, "--process-type", processType, "--default-port", strconv.Itoa(port), "--env-file", tempFile.Name()}, }) if err != nil { return "", fmt.Errorf("Error running procfile-util: %s", err) diff --git a/plugins/ps/triggers.go b/plugins/ps/triggers.go index ad69a9f61..0e355933c 100644 --- a/plugins/ps/triggers.go +++ b/plugins/ps/triggers.go @@ -274,7 +274,7 @@ func TriggerProcfileGetCommand(appName string, processType string, port int) err return nil } - command, err := getProcfileCommand(getProcessSpecificProcfilePath(appName), processType, port) + command, err := getProcfileCommand(appName, getProcessSpecificProcfilePath(appName), processType, port) if err != nil { return err }