-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry.sh
35 lines (24 loc) · 902 Bytes
/
entry.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
set -euo pipefail
# Validate environment variables
MISSING=""
[ -z "${DOMAIN}" ] && MISSING="${MISSING} DOMAIN"
[ -z "${PORT}" ] && MISSING="${MISSING} PORT"
if [ "${MISSING}" != "" ]; then
echo "Missing required environment variables:" >&2
echo " ${MISSING}" >&2
exit 1
fi
# Create the database folder if it doesn't exists
if [ ! -d /data ]; then
mkdir /data
fi
#update configuration file
sed -i '/public_url =/ c\public_url = http://'${DOMAIN}'' /syncserver/syncserver.ini
sed -i '/sqluri =/ c\sqluri = sqlite:////data/dbsync.db' /syncserver/syncserver.ini
sed -i '/port =/ c\port = '${PORT}'' /syncserver/syncserver.ini
#Don't users to register
[ -n "${NO_REGISTER:-}" ] && sed -i '/allow_new_users =/ c\allow_new_users = false' /syncserver/syncserver.ini
echo "Launching Firefox Sync Server on '${DOMAIN}'"
# Launch firefox sync server
cd /syncserver && make serve