Skip to content

Commit

Permalink
protect the savedir setting
Browse files Browse the repository at this point in the history
We do not need to to use symlinks for configuring the data dir. Instead
we can simply set it via config and also make sure that it cannot be
changed from the config manager.
  • Loading branch information
splitbrain committed Apr 11, 2024
1 parent 6c0a036 commit 4f6b3aa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 0 additions & 2 deletions root/build-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ mkdir /storage
# Move writable directories and create symlinks to the storage volume
mv /var/www/html/conf /var/www/html/conf.core
ln -s /storage/conf /var/www/html/conf
mv /var/www/html/data /var/www/html/data.core
ln -s /storage/data /var/www/html/data
mv /var/www/html/lib/plugins /var/www/html/lib/plugins.core
ln -s /storage/lib/plugins /var/www/html/lib/plugins
mv /var/www/html/lib/tpl /var/www/html/lib/tpl.core
Expand Down
2 changes: 1 addition & 1 deletion root/dokuwiki-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
# copy core data directories to the volume
# this will update syntax.txt etc. on image update
mkdir -p /storage/data
cp -r /var/www/html/data.core/. /storage/data # includes hidden files
cp -r /var/www/html/data/. /storage/data # includes hidden files

# ensure the conf directory exists, defaults are set via config_cascade
mkdir -p /storage/conf
Expand Down
2 changes: 1 addition & 1 deletion root/etc/apache2/conf-available/dokuwiki.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
AllowOverride All

XSendFile on
XSendFilePath /var/www/html/data/
XSendFilePath /storage/data/
</Directory>

<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
Expand Down
6 changes: 6 additions & 0 deletions root/var/www/html/conf/docker.protected.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* settings that should not be overwritten in the docker environment
*/
$conf['savedir'] = '/storage/data';

4 changes: 4 additions & 0 deletions root/var/www/html/inc/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
if (!defined('DOKU_CONF')) define('DOKU_CONF', __DIR__ . '/../conf/');
include __DIR__ . '/config_cascade.php';
$config_cascade['main']['default'] = ['/var/www/html/conf.core/dokuwiki.php', '/var/www/html/conf.core/docker.php'];
$config_cascade['main']['protected'] = [
DOKU_CONF . 'local.protected.php',
'/var/www/html/conf.core/docker.protected.php'
];
$config_cascade['acronyms']['default'] = ['/var/www/html/conf.core/acronyms.conf'];
$config_cascade['entities']['default'] = ['/var/www/html/conf.core/entities.conf'];
$config_cascade['interwiki']['default'] = ['/var/www/html/conf.core/interwiki.conf'];
Expand Down

0 comments on commit 4f6b3aa

Please sign in to comment.