Commit 4774b880 authored by Ian Fijolek's avatar Ian Fijolek

Move ldap configuration to it's own scripts

parent f7ce815d
......@@ -10,7 +10,6 @@ ENV CONFIG_FILE=/app/data/config.json
ENV SIGNUPS_ALLOWED=false
ENV INVITATIONS_ALLOWED=true
ENV DISABLE_ADMIN_TOKEN=false
ENV WEBSOCKET_ENABLED=true
RUN mkdir -p /app/data
......@@ -36,6 +35,6 @@ COPY --from=vividboarder/bitwarden_rs_ldap:v0.1.0 /usr/local/cargo/bin/bitwarden
WORKDIR /app/code
COPY start.sh /app/code/start.sh
COPY ldap_sync.sh /app/code/ldap_sync.sh
COPY config.template.toml /app/code/config.template.toml
COPY ldap_config.template.toml /app/code/ldap_config.template.toml
CMD [ "/app/code/start.sh" ]
#! /bin/bash
set -e
export CONFIG_PATH=/run/config.toml
export ADMIN_TOKEN=$(cat /app/data/admin_token)
# Generate ldap sync config from template
sed -e "s/##LDAP_SERVER/${LDAP_SERVER}/"\
-e "s/##LDAP_PORT/${LDAP_PORT}/"\
-e "s/##LDAP_USERS_BASE_DN/${LDAP_USERS_BASE_DN}/"\
-e "s/##LDAP_BIND_DN/${LDAP_BIND_DN}/"\
-e "s/##LDAP_BIND_PASSWORD/${LDAP_BIND_PASSWORD}/"\
-e "s/##BITWARDEN_HOSTNAME/${CLOUDRON_APP_HOSTNAME}/"\
-e "s/##ADMIN_TOKEN/${ADMIN_TOKEN}/"\
/app/code/ldap_config.template.toml > /run/ldap_config.toml
export CONFIG_PATH=/run/ldap_config.toml
exec /app/code/bitwarden_rs_ldap
......@@ -16,16 +16,7 @@ if [[ ! -f /app/data/admin_token ]]; then
pwgen -1 48 -s > /app/data/admin_token
fi
export ADMIN_TOKEN=$(cat /app/data/admin_token)
# Generate ldap sync config from template
sed -e "s/##LDAP_SERVER/${LDAP_SERVER}/"\
-e "s/##LDAP_PORT/${LDAP_PORT}/"\
-e "s/##LDAP_USERS_BASE_DN/${LDAP_USERS_BASE_DN}/"\
-e "s/##LDAP_BIND_DN/${LDAP_BIND_DN}/"\
-e "s/##LDAP_BIND_PASSWORD/${LDAP_BIND_PASSWORD}/"\
-e "s/##BITWARDEN_HOSTNAME/${CLOUDRON_APP_HOSTNAME}/"\
-e "s/##ADMIN_TOKEN/${ADMIN_TOKEN}/"\
/app/code/config.template.toml > /run/config.toml
echo "=> Admin token: ${ADMIN_TOKEN}"
echo "=> Starting apache"
APACHE_CONFDIR="" source /etc/apache2/envvars
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment