forked from NodeBB/NodeBB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·56 lines (45 loc) · 1.17 KB
/
init.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
if [ -f .env ]; then
export $(cat .env | xargs)
fi
CONFIG=$(
cat <<-END
{
"url": "$URL",
"database": "mongo",
"port": "$PORT",
"mongo:host": "$DB_HOST",
"mongo:port": "$DB_PORT",
"mongo:username": "$DB_USER",
"mongo:password": "$DB_PASSWORD",
"mongo:database": "$DB_NAME",
"admin:username": "$ADMIN_NAME",
"admin:password": "$ADMIN_PASSWORD",
"admin:password:confirm": "$ADMIN_PASSWORD",
"admin:email": "$ADMIN_EMAIL"
}
END
)
if ! [ -e /data/config.json ]; then
node app --setup=\"$(printf '%s' $(echo $CONFIG))\"
mv /usr/src/app/config.json /data/config.json
ln -s /data/config.json /usr/src/app/config.json
else
if [ ! -e /usr/src/app/config.json ]; then
ln -s /data/config.json /usr/src/app/config.json
fi
fi
if [ ! -e /data/uploads ]; then
mv /usr/src/app/public/uploads /data/uploads &&
ln -s /data/uploads /usr/src/app/public/uploads
else
rm -rf /usr/src/app/public/uploads &&
ln -s /data/uploads /usr/src/app/public/uploads
fi
if [ -f config.json ]; then
node ./add-configs.js
/usr/src/app/nodebb build --series
/usr/src/app/nodebb upgrade -mips
fi
/usr/src/app/nodebb start