Semaphore/db_lib/LocalApp.go

35 lines
729 B
Go
Raw Normal View History

2024-01-30 16:42:56 +01:00
package db_lib
import (
2024-10-22 08:46:26 +02:00
"fmt"
2024-01-30 16:42:56 +01:00
"os"
"github.com/semaphoreui/semaphore/pkg/task_logger"
"github.com/semaphoreui/semaphore/util"
2024-01-30 16:42:56 +01:00
)
func getEnvironmentVars() []string {
2024-10-27 23:14:18 +01:00
res := []string{
fmt.Sprintf("PATH=%s", os.Getenv("PATH")),
}
2024-10-24 19:53:33 +02:00
2024-10-24 20:07:25 +02:00
for _, e := range util.Config.ForwardedEnvVars {
v := os.Getenv(e)
if v != "" {
res = append(res, fmt.Sprintf("%s=%s", e, v))
2024-10-24 19:53:33 +02:00
}
}
for k, v := range util.Config.EnvVars {
2024-10-22 08:46:26 +02:00
res = append(res, fmt.Sprintf("%s=%s", k, v))
}
2024-10-24 19:53:33 +02:00
return res
}
2024-01-30 16:42:56 +01:00
type LocalApp interface {
SetLogger(logger task_logger.Logger) task_logger.Logger
InstallRequirements(environmentVars *[]string) error
Run(args []string, environmentVars *[]string, inputs map[string]string, cb func(*os.Process)) error
2024-01-30 16:42:56 +01:00
}