Skip to content

Commit 634b55d

Browse files
committed
changed appkey usage, moved appurl if, updated readme vars
1 parent 22d7ba7 commit 634b55d

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

readme-vars.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ param_env_vars:
3030
- { env_var: "DB_PASS", env_value: "<yourdbpass>", desc: "for specifying the database password" }
3131
- { env_var: "DB_DATABASE", env_value: "bookstackapp", desc: "for specifying the database to be used" }
3232
- { env_var: "APPURL", env_value: "your.site.here.xyz", desc: "for specifying the url your application will be accessed on "}
33-
- { env_var: "ADVANCED_MODE", env_value: "1", desc: "enables advanced mode for direct editing of the .env - scroll down for details on this"}
3433

3534
param_usage_include_ports: true
3635
param_ports:
@@ -63,19 +62,18 @@ app_setup_block: |
6362
6463
Documentation can be found at https://www.bookstackapp.com/docs/
6564
66-
### Advanced Mode
67-
We have implemented a special 'advanced mode' where users who wish to leverage the built in SMTP or LDAP functionality, will have the ability to edit the .env by hand. With `ADVANCED_MODE=1` set when
68-
the container is created, it will copy the .env.example to /config within the container. You can then edit this file on the host system (make sure you read the BookStack docs) and restart the
69-
container when finished. When the container starts, it copies /config/.env to /var/www/html/.env within the container for the web app to use. It will do this every time the container restarts.
70-
71-
Note, the APP_KEY is still set by PHP environment so you do not need to worrry about this.
65+
### Advanced Users
66+
If you wish to use the extra functionality of BookStack such as email, memcache, ldap and so on you will need to make your own .env file with guidance from the BookStack documentation.
67+
68+
When you create the container, do not set any arguements for SQL or APPURL. The container will copy an .env file to /config/www/.env on your host system for you to edit.
7269
7370
### Composer
7471
7572
Some simple docker-compose files are included for you to get started with. You will still need to manually configure the SQL server, but the compose files will get the stack running for you.
7673
7774
# changelog
7875
changelogs:
76+
- { date: "15.10.18:", desc: "Changed functionality for advanced users"}
7977
- { date: "08.10.18:", desc: "Advanced mode, symlink changes, sed fixing, docs updated, added some composer files"}
8078
- { date: "23.09.28:", desc: "Updates pre-release"}
8179
- { date: "02.07.18:", desc: "Initial Release." }

root/etc/cont-init.d/50-config

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ do
2222
[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i"
2323
done
2424

25+
# Create API key if needed
26+
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
27+
then
28+
echo "Generating BookStack app key for first run"
29+
key=$(php /var/www/html/artisan key:generate --show | tr -d '//' )
30+
echo $key > /config/BOOKSTACK_APP_KEY.txt
31+
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
32+
elif [ -f "/config/BOOKSTACK_APP_KEY.txt" ];
33+
then
34+
echo "App Key found - setting variable for seds"
35+
key=$(cat /config/BOOKSTACK_APP_KEY.txt)
36+
fi
37+
2538
# .env file setup
2639
# check to see if db_user is set, if it is then run seds and if not then leave them
2740
if [ "${DB_USER}" ];
@@ -32,20 +45,10 @@ if [ "${DB_USER}" ];
3245
sed -i "s/DB_DATABASE=database_database/DB_DATABASE=${DB_DATABASE}/g" /config/www/.env
3346
sed -i "s/DB_USERNAME=database_username/DB_USERNAME=${DB_USER}/g" /config/www/.env
3447
sed -i "s/DB_PASSWORD=database_user_password/DB_PASSWORD=${DB_PASS}/g" /config/www/.env
35-
elif [ "${APP_URL}" ];
36-
then
37-
echo "App URL Set"
38-
sed -i "s,#\sAPP_URL.*,APP_URL=${APP_URL},g" /config/www/.env
3948
fi
4049

41-
# Create API key if needed
42-
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ]
43-
then
44-
echo "Generating BookStack app key for first run"
45-
key=$(php /var/www/html/artisan key:generate --show | tr -d '//' )
46-
echo $key > /config/BOOKSTACK_APP_KEY.txt
47-
echo "App Key set to $key you can modify the file to update /config/BOOKSTACK_APP_KEY.txt"
48-
fi
50+
# set appurl if detected
51+
[[ "${APP_URL}" ]] && sed -i "s,#\sAPP_URL.*,APP_URL=${APP_URL},g" /config/www/.env
4952

5053
# update database - will set up database if fresh, or, migrate existing
5154
php /var/www/html/artisan migrate --force

root/etc/services.d/php-fpm/run

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/usr/bin/with-contenv bash
2-
export APP_KEY=$(cat /config/BOOKSTACK_APP_KEY.txt)
32
exec /usr/sbin/php-fpm7 -F

0 commit comments

Comments
 (0)