2024-03-18 22:24:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-10-20 22:35:26 +08:00
|
|
|
# SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2023-06-22 20:54:34 +08:00
|
|
|
## Required vars
|
|
|
|
# CPAD_MAIN_DOMAIN
|
|
|
|
# CPAD_SANDBOX_DOMAIN
|
|
|
|
# CPAD_CONF
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
CPAD_HOME="/cryptpad"
|
|
|
|
|
|
|
|
if [ ! -f "$CPAD_CONF" ]; then
|
2023-06-23 20:32:01 +08:00
|
|
|
echo -e "\n\
|
|
|
|
#################################################################### \n\
|
|
|
|
Warning: No config file provided for cryptpad \n\
|
2023-06-22 20:54:34 +08:00
|
|
|
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\
|
2023-06-23 20:32:01 +08:00
|
|
|
#################################################################### \n"
|
2023-06-22 20:54:34 +08:00
|
|
|
|
2024-02-26 15:37:25 +08:00
|
|
|
cp "$CPAD_HOME"/config/config.example.js "$CPAD_CONF"
|
2023-06-22 20:54:34 +08:00
|
|
|
|
2024-02-26 15:37:25 +08:00
|
|
|
sed -i -e "s@\(httpUnsafeOrigin:\).*[^,]@\1 '$CPAD_MAIN_DOMAIN'@" \
|
|
|
|
-e "s@\(^ *\).*\(httpSafeOrigin:\).*[^,]@\1\2 '$CPAD_SANDBOX_DOMAIN'@" "$CPAD_CONF"
|
2023-06-23 20:32:01 +08:00
|
|
|
fi
|
2023-06-22 20:54:34 +08:00
|
|
|
|
|
|
|
cd $CPAD_HOME
|
2024-02-26 22:20:17 +08:00
|
|
|
|
|
|
|
if [ "$CPAD_INSTALL_ONLYOFFICE" == "yes" ]; then
|
2024-07-02 07:48:39 +08:00
|
|
|
./install-onlyoffice.sh --accept-license --trust-repository
|
2024-02-26 22:20:17 +08:00
|
|
|
fi
|
|
|
|
|
2023-06-22 20:54:34 +08:00
|
|
|
npm run build
|
|
|
|
|
|
|
|
exec "$@"
|