From ce51a0c32c0dd80dc17ebaed7915990e835974df Mon Sep 17 00:00:00 2001 From: tcatrain Date: Thu, 20 Jul 2017 11:16:07 +0200 Subject: [PATCH] Handling LDAP configuration at docker environment variable level --- scripts/docker-startup.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/docker-startup.sh b/scripts/docker-startup.sh index 0ef80949..9522cf54 100755 --- a/scripts/docker-startup.sh +++ b/scripts/docker-startup.sh @@ -16,6 +16,19 @@ SEMAPHORE_ADMIN="${SEMAPHORE_ADMIN:-admin}" SEMAPHORE_ADMIN_EMAIL="${SEMAPHORE_ADMIN_EMAIL:-admin@localhost}" SEMAPHORE_ADMIN_NAME="${SEMAPHORE_ADMIN_NAME:-Semaphore Admin}" SEMAPHORE_ADMIN_PASSWORD="${SEMAPHORE_ADMIN_PASSWORD:-semaphorepassword}" +#Semaphore LDAP env config +SEMAPHORE_LDAP_ACTIVATED="${SEMAPHORE_LDAP_ACTIVATED:-no}" +SEMAPHORE_LDAP_HOST="${SEMAPHORE_LDAP_HOST:-}" +SEMAPHORE_LDAP_PORT="${SEMAPHORE_LDAP_PORT:-}" +SEMAPHORE_LDAP_NEEDTLS="${SEMAPHORE_LDAP_NEEDTLS:-no}" +SEMAPHORE_LDAP_DN_BIND="${SEMAPHORE_LDAP_DN_BIND:-}" +SEMAPHORE_LDAP_PASSWORD="${SEMAPHORE_LDAP_PASSWORD:-}" +SEMAPHORE_LDAP_DN_SEARCH="${SEMAPHORE_LDAP_DN_SEARCH:-}" +SEMAPHORE_LDAP_SEARCH_FILTER="${SEMAPHORE_LDAP_SEARCH_FILTER:-(uid=%s)}" +SEMAPHORE_LDAP_MAPPING_DN="${SEMAPHORE_LDAP_MAPPING_DN:-dn}" +SEMAPHORE_LDAP_MAPPING_USERNAME="${SEMAPHORE_LDAP_MAPPING_USERNAME:-uid}" +SEMAPHORE_LDAP_MAPPING_FULLNAME="${SEMAPHORE_LDAP_MAPPING_FULLNAME:-cn}" +SEMAPHORE_LDAP_MAPPING_EMAIL="${SEMAPHORE_LDAP_MAPPING_EMAIL:-mail}" # create semaphore playbook directory mkdir -p "${SEMAPHORE_PLAYBOOK_PATH}" || { @@ -47,7 +60,25 @@ ${SEMAPHORE_PLAYBOOK_PATH} ${SEMAPHORE_WEB_ROOT} no no -no +${SEMAPHORE_LDAP_ACTIVATED} +EOF + + if [ "${SEMAPHORE_LDAP_ACTIVATED}" = "yes" ]; then + cat << EOF >> "${SEMAPHORE_PLAYBOOK_PATH}/config.stdin" +${SEMAPHORE_LDAP_HOST}:${SEMAPHORE_LDAP_PORT} +${SEMAPHORE_LDAP_NEEDTLS} +${SEMAPHORE_LDAP_DN_BIND} +${SEMAPHORE_LDAP_PASSWORD} +${SEMAPHORE_LDAP_DN_SEARCH} +${SEMAPHORE_LDAP_SEARCH_FILTER} +${SEMAPHORE_LDAP_MAPPING_DN} +${SEMAPHORE_LDAP_MAPPING_USERNAME} +${SEMAPHORE_LDAP_MAPPING_FULLNAME} +${SEMAPHORE_LDAP_MAPPING_EMAIL} +EOF + fi; + + cat << EOF >> "${SEMAPHORE_PLAYBOOK_PATH}/config.stdin" yes ${SEMAPHORE_ADMIN} ${SEMAPHORE_ADMIN_EMAIL}