2021-11-02 16:56:53 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-23 14:21:19 +03:00
|
|
|
if [ -f "meshcentral-data/${CONFIG_FILE}" ]
|
2021-11-02 16:56:53 +03:00
|
|
|
then
|
2022-07-23 14:21:19 +03:00
|
|
|
node meshcentral/meshcentral --configfile ${CONFIG_FILE}
|
2021-11-02 16:56:53 +03:00
|
|
|
else
|
2022-07-23 14:21:19 +03:00
|
|
|
cp config.json.template meshcentral-data/${CONFIG_FILE}
|
2022-06-09 22:25:01 +03:00
|
|
|
if ! [ -z "$USE_MONGODB" ] && [ "$USE_MONGODB" == "true" ]; then
|
2022-07-23 14:21:19 +03:00
|
|
|
sed -i "s/\"_mongoDb\": null/\"mongoDb\": \"mongodb:\/\/$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017\"/" meshcentral-data/${CONFIG_FILE}
|
2022-06-06 20:44:13 +03:00
|
|
|
fi
|
2022-07-23 14:21:19 +03:00
|
|
|
sed -i "s/\"cert\": \"myserver.mydomain.com\"/\"cert\": \"$HOSTNAME\"/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"NewAccounts\": true/\"NewAccounts\": $ALLOW_NEW_ACCOUNTS/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"enabled\": false/\"enabled\": $ALLOWPLUGINS/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"localSessionRecording\": false/\"localSessionRecording\": $LOCALSESSIONRECORDING/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"minify\": true/\"minify\": $MINIFY/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"WebRTC\": false/\"WebRTC\": $WEBRTC/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
sed -i "s/\"AllowFraming\": false/\"AllowFraming\": $IFRAME/" meshcentral-data/${CONFIG_FILE}
|
2022-06-06 20:39:36 +03:00
|
|
|
if [ "$REVERSE_PROXY" != "false" ]; then
|
2022-07-23 14:21:19 +03:00
|
|
|
sed -i "s/\"_certUrl\": \"my\.reverse\.proxy\"/\"certUrl\": \"https:\/\/$REVERSE_PROXY:$REVERSE_PROXY_TLS_PORT\"/" meshcentral-data/${CONFIG_FILE}
|
|
|
|
node meshcentral/meshcentral --configfile ${CONFIG_FILE}
|
2022-06-06 20:39:36 +03:00
|
|
|
exit
|
2021-11-02 16:56:53 +03:00
|
|
|
fi
|
2022-07-23 14:21:19 +03:00
|
|
|
node meshcentral/meshcentral --configfile ${CONFIG_FILE} --cert "$HOSTNAME"
|
|
|
|
fi
|