diff --git a/db_lib/AnsiblePlaybook.go b/db_lib/AnsiblePlaybook.go index 019f10ab..48c357ee 100644 --- a/db_lib/AnsiblePlaybook.go +++ b/db_lib/AnsiblePlaybook.go @@ -31,18 +31,8 @@ func (p AnsiblePlaybook) makeCmd(command string, args []string, environmentVars cmd.Env = append(cmd.Env, *environmentVars...) } - sensitiveEnvs := []string{ - "SEMAPHORE_ACCESS_KEY_ENCRYPTION", - "SEMAPHORE_ADMIN_PASSWORD", - "SEMAPHORE_DB_USER", - "SEMAPHORE_DB_NAME", - "SEMAPHORE_DB_HOST", - "SEMAPHORE_DB_PASS", - "SEMAPHORE_LDAP_PASSWORD", - } - // Remove sensitive env variables from cmd process - for _, env := range sensitiveEnvs { + for _, env := range getSensitiveEnvs() { cmd.Env = append(cmd.Env, env+"=") } diff --git a/db_lib/LocalApp.go b/db_lib/LocalApp.go index f0f6c94b..21438868 100644 --- a/db_lib/LocalApp.go +++ b/db_lib/LocalApp.go @@ -6,6 +6,18 @@ import ( "github.com/ansible-semaphore/semaphore/pkg/task_logger" ) +func getSensitiveEnvs() []string { + return []string{ + "SEMAPHORE_ACCESS_KEY_ENCRYPTION", + "SEMAPHORE_ADMIN_PASSWORD", + "SEMAPHORE_DB_USER", + "SEMAPHORE_DB_NAME", + "SEMAPHORE_DB_HOST", + "SEMAPHORE_DB_PASS", + "SEMAPHORE_LDAP_PASSWORD", + } +} + type LocalApp interface { SetLogger(logger task_logger.Logger) task_logger.Logger InstallRequirements() error