From da66ef4a81cecc8bdc9ad641dbfdc7c018115087 Mon Sep 17 00:00:00 2001 From: Michael Meidlinger Date: Fri, 19 May 2023 13:28:42 +0200 Subject: [PATCH] If configured via environment variables, setup an S3 bucket as storage backend for nextcloud --- setup/nextcloud.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index b79de327..8552a8cd 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -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 < $CONFIG_TEMP && mv $CONFIG_TEMP $STORAGE_ROOT/owncloud/config.php; + '\\OC\\Files\\ObjectStore\\S3', + 'arguments' => array( + 'bucket' => '$NEXTCLOUD_S3_BUCKET', + 'autocreate' => false, + 'use_ssl' => true, + 'region' => '$NEXTCLOUD_S3_REGION' + ), +); + +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