If configured via environment variables, setup an S3 bucket as storage backend for nextcloud

This commit is contained in:
Michael Meidlinger 2023-05-19 13:28:42 +02:00
parent 93380b243f
commit da66ef4a81
1 changed files with 24 additions and 0 deletions

View File

@ -313,6 +313,30 @@ echo ";";
EOF
chown www-data:www-data $STORAGE_ROOT/owncloud/config.php
# Update config.php in case S3 object storage backend if configured
if [[ -n "${NEXTCLOUD_S3_BUCKET:-}" && -n "${NEXTCLOUD_S3_REGION:-}" ]]; then
php$PHP_VER <<EOF > $CONFIG_TEMP && mv $CONFIG_TEMP $STORAGE_ROOT/owncloud/config.php;
<?php
include("$STORAGE_ROOT/owncloud/config.php");
\$CONFIG['objectstore'] = array(
'class' => '\\OC\\Files\\ObjectStore\\S3',
'arguments' => array(
'bucket' => '$NEXTCLOUD_S3_BUCKET',
'autocreate' => false,
'use_ssl' => true,
'region' => '$NEXTCLOUD_S3_REGION'
),
);
echo "<?php\n\\\$CONFIG = ";
var_export(\$CONFIG);
echo ";";
?>
EOF
chown www-data.www-data $STORAGE_ROOT/owncloud/config.php
fi
# Enable/disable apps. Note that this must be done after the Nextcloud setup.
# The firstrunwizard gave Josh all sorts of problems, so disabling that.
# user_external is what allows Nextcloud to use IMAP for login. The contacts