2024-01-30 16:42:56 +01:00
|
|
|
package db_lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2024-07-10 13:23:34 +02:00
|
|
|
"strings"
|
2024-04-12 12:32:54 +02:00
|
|
|
|
|
|
|
"github.com/ansible-semaphore/semaphore/pkg/task_logger"
|
2024-01-30 16:42:56 +01:00
|
|
|
)
|
|
|
|
|
2024-07-10 13:23:34 +02:00
|
|
|
func removeSensitiveEnvs(envs []string) (res []string) {
|
|
|
|
sensitives := []string{
|
2024-05-21 13:39:51 +02:00
|
|
|
"SEMAPHORE_ACCESS_KEY_ENCRYPTION",
|
|
|
|
"SEMAPHORE_ADMIN_PASSWORD",
|
|
|
|
"SEMAPHORE_DB_USER",
|
|
|
|
"SEMAPHORE_DB_NAME",
|
|
|
|
"SEMAPHORE_DB_HOST",
|
|
|
|
"SEMAPHORE_DB_PASS",
|
|
|
|
"SEMAPHORE_LDAP_PASSWORD",
|
2024-09-24 17:58:51 +02:00
|
|
|
"SEMAPHORE_RUNNER_TOKEN",
|
|
|
|
"SEMAPHORE_RUNNER_ID",
|
2024-05-21 13:39:51 +02:00
|
|
|
}
|
2024-07-10 13:23:34 +02:00
|
|
|
|
|
|
|
for _, e := range envs {
|
|
|
|
for _, s := range sensitives {
|
|
|
|
if !strings.HasPrefix(e, s+"=") {
|
|
|
|
res = append(res, e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return res
|
2024-05-21 13:39:51 +02:00
|
|
|
}
|
|
|
|
|
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-01-30 16:42:56 +01:00
|
|
|
InstallRequirements() 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
|
|
|
}
|