Create startup.sh
Einar Stenberg committed
Nov 2, 2021 at 14:56 UTC
a11631502d58fcb0f46a9e050ee85ffdafc07a0a
1 file changed
+28
docker/startup.sh
new
+28
@@ -0,0 +1,28 @@
1
+#!/bin/bash
2
+
3
+export NODE_ENV=production
4
+
5
+export HOSTNAME
6
+export REVERSE_PROXY
7
+export REVERSE_PROXY_TLS_PORT
8
+export IFRAME
9
+export ALLOW_NEW_ACCOUNTS
10
+export WEBRTC
11
+
12
+if [ -f "meshcentral-data/config.json" ]
13
+ then
14
+ node node_modules/meshcentral
15
+ else
16
+ cp config.json.template meshcentral-data/config.json
17
+ sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/config.json
18
+ sed -i "s/\"NewAccounts\": true/\"NewAccounts\": \"$ALLOW_NEW_ACCOUNTS\"/" meshcentral-data/config.json
19
+ sed -i "s/\"WebRTC\": false/\"WebRTC\": \"$WEBRTC\"/" meshcentral-data/config.json
20
+ sed -i "s/\"AllowFraming\": false/\"AllowFraming\": \"$IFRAME\"/" meshcentral-data/config.json
21
+ if [ "$REVERSE_PROXY" != "false" ]
22
+ then
23
+ sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/config.json
24
+ node node_modules/meshcentral
25
+ exit
26
+ fi
27
+ node node_modules/meshcentral --cert "$HOSTNAME"
28
+fi