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"
|
2024-04-12 12:32:54 +02:00
|
|
|
|
|
|
|
"github.com/ansible-semaphore/semaphore/pkg/task_logger"
|
2024-10-22 08:35:55 +02:00
|
|
|
"github.com/ansible-semaphore/semaphore/util"
|
2024-01-30 16:42:56 +01:00
|
|
|
)
|
|
|
|
|
2024-10-22 08:35:55 +02:00
|
|
|
func getEnvironmentVars() []string {
|
|
|
|
res := []string{}
|
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-22 08:35:55 +02:00
|
|
|
}
|
2024-10-24 19:53:33 +02:00
|
|
|
|
2024-10-22 08:35:55 +02:00
|
|
|
return res
|
|
|
|
}
|
|
|
|
|
2024-01-30 16:42:56 +01:00
|
|
|
type LocalApp interface {
|
2024-04-12 12:32:54 +02:00
|
|
|
SetLogger(logger task_logger.Logger) task_logger.Logger
|
2024-10-10 13:36:59 +02:00
|
|
|
InstallRequirements(environmentVars *[]string) error
|
2024-04-05 14:36:04 +02:00
|
|
|
Run(args []string, environmentVars *[]string, inputs map[string]string, cb func(*os.Process)) error
|
2024-01-30 16:42:56 +01:00
|
|
|
}
|