setup config

Signed-off-by: Eric Nemchik <eric@nemchik.com>
This commit is contained in:
Eric Nemchik 2023-06-06 23:00:47 -05:00
parent d1ddb603b0
commit 91f7977eff
No known key found for this signature in database
2 changed files with 30 additions and 6 deletions

View File

@ -1,6 +1,18 @@
<?php
$CONFIG = array (
'memcache.local' => '\OC\Memcache\APCu',
$CONFIG = [
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Memcached',
'datadirectory' => '/data',
);
'apps_paths' => [
0 => [
'path' => '/app/www/public/apps',
'url' => '/apps',
'writable' => false,
],
1 => [
'path' => '/app/www/public/custom_apps',
'url' => '/custom_apps',
'writable' => true,
],
],
];

View File

@ -35,9 +35,21 @@ for dir in config custom_apps themes; do
fi
done
# copy defaults
# setup config
cp -n /defaults/config.php /app/www/public/config/config.php 2> >(grep -v 'cp: not replacing')
datadirectory=$(php -r "require '/app/www/public/config/config.php'; echo \$CONFIG['datadirectory'];" 2>/dev/null)
if ! occ config:system:get memcache.local; then
occ config:system:set memcache.local --value='\\OC\\Memcache\\APCu'
fi
if ! occ config:system:get memcache.distributed; then
occ config:system:set memcache.distributed --value='\\OC\\Memcache\\Memcached'
fi
if ! occ config:system:get datadirectory; then
occ config:system:set datadirectory --value='/data'
fi
if ! occ config:system:get apps_paths || ! occ config:system:get apps_paths | grep -q 'path: /app/www/public/apps' || ! occ config:system:get apps_paths | grep -q 'path: /app/www/public/custom_apps'; then
occ config:import < <(echo '{"system":{"apps_paths":[{"path":"\/app\/www\/public\/apps","url":"\/apps","writable":false},{"path":"\/app\/www\/public\/custom_apps","url":"\/custom_apps","writable":true}]}}')
fi
datadirectory=$(occ config:system:get datadirectory)
# symlink data folder
if [ "$(readlink /app/www/public/data)" != "${datadirectory}" ]; then