From 84c775e440e414a20ce08913bc8fcac2615fc5ce Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Wed, 23 Sep 2020 23:52:59 -0700 Subject: [PATCH] Adds ability to configure swift object store though environment (#1243) Signed-off-by: Adam Jenkins --- .config/swift.config.php | 31 +++++++++++++++++++++++++++++++ README.md | 14 ++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .config/swift.config.php diff --git a/.config/swift.config.php b/.config/swift.config.php new file mode 100644 index 00000000..47ada566 --- /dev/null +++ b/.config/swift.config.php @@ -0,0 +1,31 @@ + [ + 'class' => 'OC\\Files\\ObjectStore\\Swift', + 'arguments' => [ + 'autocreate' => $autocreate == true && strtolower($autocreate) !== 'false', + 'user' => [ + 'name' => getenv('OBJECTSTORE_SWIFT_USER_NAME'), + 'password' => getenv('OBJECTSTORE_SWIFT_USER_PASSWORD'), + 'domain' => [ + 'name' => (getenv('OBJECTSTORE_SWIFT_USER_DOMAIN')) ?: 'Default', + ], + ], + 'scope' => [ + 'project' => [ + 'name' => getenv('OBJECTSTORE_SWIFT_PROJECT_NAME'), + 'domain' => [ + 'name' => (getenv('OBJECTSTORE_SWIFT_PROJECT_DOMAIN')) ?: 'Default', + ], + ], + ], + 'serviceName' => (getenv('OBJECTSTORE_SWIFT_SERVICE_NAME')) ?: 'swift', + 'region' => getenv('OBJECTSTORE_SWIFT_REGION'), + 'url' => getenv('OBJECTSTORE_SWIFT_URL'), + 'bucket' => getenv('OBJECTSTORE_SWIFT_CONTAINER_NAME'), + ] + ] + ); +} diff --git a/README.md b/README.md index b288a983..fc2b50d0 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,20 @@ To use an external S3 compatible object store as primary storage, set the follow Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) for more information. +To use an external OpenStack Swift object store as primary storage, set the following variables: +- `OBJECTSTORE_SWIFT_URL`: The Swift identity (Keystone) endpoint +- `OBJECTSTORE_SWIFT_AUTOCREATE` (default: `false`): Whether or not Nextcloud should automatically create the Swift container +- `OBJECTSTORE_SWIFT_USER_NAME`: Swift username +- `OBJECTSTORE_SWIFT_USER_PASSWORD`: Swift user password +- `OBJECTSTORE_SWIFT_USER_DOMAIN` (default: `Default`): Swift user domain +- `OBJECTSTORE_SWIFT_PROJECT_NAME`: OpenStack project name +- `OBJECTSTORE_SWIFT_PROJECT_DOMAIN` (default: `Default`): OpenStack project domain +- `OBJECTSTORE_SWIFT_SERVICE_NAME` (default: `swift`): Swift service name +- `OBJECTSTORE_SWIFT_SERVICE_REGION`: Swift endpoint region +- `OBJECTSTORE_SWIFT_CONTAINER_NAME`: Swift container (bucket) that Nextcloud should store the data in + +Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#openstack-swift) for more information. + ## Using the apache image behind a reverse proxy and auto configure server host and protocol