You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# check for ADVANCED_MODE to be != 0; copy sample env file to /config and ln to /var/www/html if != 0, if = 0 then copy .example.env to .env and run seds
20
-
if [ "$ADVANCED_MODE" == 1 && ! -f "/config/.env" ];
20
+
# Check for ADVANCED_MODE to be set. If set, copy sample env file to /config and then copy to /var/www/html.env so advanced users can make their own customisations
21
+
# If not set, runs in basic mode where .example.env is copied to /var/www/html/.env and seds are applied to set documented variables
22
+
if [ "$ADVANCED_MODE" == 1 ];
21
23
then
22
-
echo "Advanced Mode"
23
-
cp /var/www/html/.env.example /config/.env
24
-
ln -s /config/.env /var/www/html/.env
24
+
echo "Advanced Mode Enabled - Syncing .env from /config to /var/www/html"
25
+
[[ ! -f "/config/.env" ]] && \
26
+
cp /var/www/html/.env.example /config/.env
27
+
cp /config/.env /var/www/html/.env
25
28
elif [ -z "$ADVANCED_MODE" ];
26
-
echo "Basic Mode"
29
+
then
30
+
echo "Basic Mode Enabled - Using sed to set BookStack variables from Docker environment variables - check the docs"
27
31
cp /var/www/html/.env.example /var/www/html/.env
32
+
# set up .env
33
+
sed -i "s/APP_KEY=SomeRandomString/APP_KEY=$key/g" /var/www/html/.env
34
+
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /var/www/html/.env
35
+
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /var/www/html/.env
36
+
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /var/www/html/.env
37
+
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /var/www/html/.env
38
+
sed -i "s/# APP_URL=.*/APP_URL=${APP_URL}/g" /var/www/html/.env
28
39
else
29
-
echo "Finished symlinks"
40
+
echo "Nothing to do with .env - what did you do homer?"
30
41
fi
31
42
32
43
# Create API key if needed
@@ -38,14 +49,6 @@ if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]
38
49
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
39
50
fi
40
51
41
-
# set up .env
42
-
sed -i "s/APP_KEY=SomeRandomString/APP_KEY=$key/g" /var/www/html/.env
43
-
sed -i "s/DB_HOST=localhost/DB_HOST=${DB_HOST}/g" /var/www/html/.env
44
-
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /var/www/html/.env
45
-
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /var/www/html/.env
46
-
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /var/www/html/.env
0 commit comments