diff --git a/pica-etherpad/entrypoint.sh b/pica-etherpad/entrypoint.sh index ee8bcccd9405e828957dfb0a2eafc48071e3b378..3054d913c76bf1d149af16054ba2310037844d8e 100644 --- a/pica-etherpad/entrypoint.sh +++ b/pica-etherpad/entrypoint.sh @@ -1,42 +1,42 @@ #!/usr/bin/env bash set -e -if [ -z "${ETHERPAD_ADMIN_PASSWORD}" ]; then - echo >&2 'Error : missing required ${ETHERPAD_ADMIN_PASSWORD} environment variable, exiting.' +if [ -z "${ADMIN_PASSWORD}" ]; then + echo >&2 'Error : missing required ${ADMIN_PASSWORD} environment variable, exiting.' exit 1 fi -if [ -z "${ETHERPAD_DB_NAME}" ]; then - echo >&2 'Error : missing required ${ETHERPAD_DB_NAME} environment variable, exiting.' +if [ -z "${DB_NAME}" ]; then + echo >&2 'Error : missing required ${DB_NAME} environment variable, exiting.' exit 1 fi -if [ -z "${ETHERPAD_DB_USER}" ]; then - echo >&2 'Error : missing required ${ETHERPAD_DB_USER} environment variable, exiting.' +if [ -z "${DB_USER}" ]; then + echo >&2 'Error : missing required ${DB_USER} environment variable, exiting.' exit 1 fi -if [ -z "${ETHERPAD_DB_PASSWORD}" ]; then - echo >&2 'Error : missing required ${ETHERPAD_DB_PASSWORD} environment variable, exiting.' +if [ -z "${DB_PASSWORD}" ]; then + echo >&2 'Error : missing required ${DB_PASSWORD} environment variable, exiting.' exit 1 fi -if [ -z "${ETHERPAD_DB_HOST}" ]; then - echo >&2 'Error : missing required ${ETHERPAD_DB_HOST} environment variable, exiting.' +if [ -z "${DB_HOST}" ]; then + echo >&2 'Error : missing required ${DB_HOST} environment variable, exiting.' exit 1 fi -while ! mysqladmin ping -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -h"${ETHERPAD_DB_HOST}"; do +while ! mysqladmin ping -u${DB_USER} -p${DB_PASSWORD} -h"${DB_HOST}"; do sleep 1 done # Check if database already exists -RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \ - -h${ETHERPAD_DB_HOST} --skip-column-names \ - -e "SHOW DATABASES LIKE '${ETHERPAD_DB_NAME}'"` +RESULT=`mysql -u${DB_USER} -p${DB_PASSWORD} \ + -h${DB_HOST} --skip-column-names \ + -e "SHOW DATABASES LIKE '${DB_NAME}'"` -if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then +if [ "$RESULT" != $DB_NAME ]; then # mysql database does not exist, create it - echo "Creating database ${ETHERPAD_DB_NAME}" + echo "Creating database ${DB_NAME}" - mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -h${ETHERPAD_DB_HOST} \ - -e "create database ${ETHERPAD_DB_NAME}" + mysql -u${DB_USER} -p${DB_PASSWORD} -h${DB_HOST} \ + -e "create database ${DB_NAME}" fi exec "$@"