cryptpad/container-start.sh

31 lines
924 B
Bash
Raw Normal View History

2017-04-09 09:36:33 +00:00
#!/bin/sh
2016-12-29 21:02:03 +00:00
# Creating customize folder
mkdir -p customize
# Copying default config
2019-03-29 10:33:49 +00:00
mkdir -p cfg
[ ! -f cfg/config.js ] && echo "Creating config.js" && cp config/config.example.js cfg/config.js
# Linking config.js
[ ! -L config/config.js ] && echo "Linking config.js" && ln -s ../cfg/config.js config/config.js
2016-12-29 21:02:03 +00:00
# Thanks to http://stackoverflow.com/a/10467453
sedeasy() {
sed -i "s/$1/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
}
2017-04-25 14:04:17 +00:00
# Configure
2017-04-09 09:36:33 +00:00
[ -n "$USE_SSL" ] && echo "Using secure websockets: $USE_SSL" \
2019-03-29 10:33:49 +00:00
&& sedeasy "useSecureWebsockets: [^,]*," "useSecureWebsockets: ${USE_SSL}," cfg/config.js
2016-12-29 21:02:03 +00:00
2017-04-09 09:36:33 +00:00
[ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
2019-03-29 10:33:49 +00:00
&& sedeasy "storage: [^,]*," "storage: ${STORAGE}," cfg/config.js
2016-12-29 21:02:03 +00:00
2017-04-09 09:36:33 +00:00
[ -n "$LOG_TO_STDOUT" ] && echo "Logging to stdout: $LOG_TO_STDOUT" \
2019-03-29 10:33:49 +00:00
&& sedeasy "logToStdout: [^,]*," "logToStdout: ${LOG_TO_STDOUT}," cfg/config.js
2016-12-29 21:02:03 +00:00
export FRESH=1
2017-04-08 20:08:38 +00:00
exec node ./server.js