make entrypoint script working with Debian, remove outdated parts

This commit is contained in:
Mathilde Grünig 2023-06-23 14:32:01 +02:00
parent 032b094b75
commit 0cb2f42b33

29
docker-entrypoint.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#/bin/sh
#/bin/bash
## Required vars
# CPAD_MAIN_DOMAIN
@ -10,32 +10,23 @@ set -e
CPAD_HOME="/cryptpad"
# If cryptad conf isn't provided
if [ ! -f "$CPAD_CONF" ]; then
echo -e "\n\
############################################### \n\
Warning: No config file provided for CryptPad \n\
echo -e "\n\
#################################################################### \n\
Warning: No config file provided for cryptpad \n\
We will create a basic one for now but you should rerun this service \n\
by providing a file with your settings \n\
eg: docker run -v /path/to/config.js:/cryptpad/config/config.js \n\
############################################### \n"
#################################################################### \n"
cp $CPAD_HOME/config/config.example.js $CPAD_CONF
cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF"
# Set domains
sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 'https://$CPAD_MAIN_DOMAIN'@" \
-e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 'https://$CPAD_SANDBOX_DOMAIN'@" $CPAD_CONF
# Set admin email
if [ -z "$CPAD_ADMIN_EMAIL" ]; then
echo "Error: Missing admin email (Did you read the config?)"
exit 1
else
sed -i "s@\(adminEmail:\).*[^,]@\1 '$CPAD_ADMIN_EMAIL'@" $CPAD_CONF
fi
fi
sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 'https://$CPAD_MAIN_DOMAIN'@" \
-e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 'https://$CPAD_SANDBOX_DOMAIN'@" $CPAD_CONF
fi
cd $CPAD_HOME
npm run build
exec "$@"