Skip to content

Commit 1bfb735

Browse files
jessebotJ0WI
authored andcommitted
only set variables if they're actively in use
Signed-off-by: jessebot <[email protected]>
1 parent 49e139c commit 1bfb735

File tree

2 files changed

+56
-28
lines changed

2 files changed

+56
-28
lines changed

.config/s3.config.php

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
$use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');
55
$use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');
66
$autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');
7+
$proxy = getenv('OBJECTSTORE_S3_PROXY');
8+
$verify_bucket_exists = getenv('OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS');
9+
$use_multipart_copy = getenv('OBJECTSTORE_S3_USEMULTIPARTCOPY');
10+
$concurrency = getenv('OBJECTSTORE_S3_CONCURRENCY');
11+
$timeout = getenv('OBJECTSTORE_S3_TIMEOUT');
12+
$upload_part_size = getenv('OBJECTSTORE_S3_UPLOADPARTSIZE');
13+
$put_size_limit = getenv('OBJECTSTORE_S3_PUTSIZELIMIT');
14+
$copy_size_limit = getenv('OBJECTSTORE_S3_COPYSIZELIMIT');
15+
716
$CONFIG = array(
817
'objectstore' => array(
918
'class' => '\OC\Files\ObjectStore\S3',
@@ -19,18 +28,35 @@
1928
// required for some non Amazon S3 implementations
2029
'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',
2130
// required for older protocol versions
31+
'useMultipartCopy' => strtolower($useMultipartCopy) !== 'true',
2232
'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false',
23-
'concurrency' => getenv('OBJECTSTORE_S3_CONCURRENCY') ?: '',
24-
'proxy' => getenv('OBJECTSTORE_S3_PROXY') ?: '',
25-
'timeout' => getenv('OBJECTSTORE_S3_TIMEOUT') ?: '',
26-
'uploadPartSize' => getenv('OBJECTSTORE_S3_UPLOADPARTSIZE') ?:'',
27-
'putSizeLimit' => getenv('OBJECTSTORE_S3_PUTSIZELIMIT') ?: '',
28-
'version' => getenv('OBJECTSTORE_S3_VERSION') ?: '',
29-
'verify_bucket_exists' => getenv('OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS') ?: ''
33+
'proxy' => strtolower($proxy) !== 'false',
34+
'version' => getenv('OBJECTSTORE_S3_VERSION') ?: 'latest',
35+
'verify_bucket_exists' => strtolower($verify_bucket_exists) !== 'true'
3036
)
3137
)
3238
);
3339

40+
if $concurrency {
41+
$CONFIG['objectstore']['arguments']['concurrency'] = $concurrency;
42+
}
43+
44+
if $timeout {
45+
$CONFIG['objectstore']['arguments']['timeout'] = $timeout;
46+
}
47+
48+
if $upload_part_size {
49+
$CONFIG['objectstore']['arguments']['uploadPartSize'] = $upload_part_size;
50+
}
51+
52+
if $put_size_limit {
53+
$CONFIG['objectstore']['arguments']['putSizeLimit'] = $put_size_limit;
54+
}
55+
56+
if $copy_size_limit {
57+
$CONFIG['objectstore']['arguments']['copySizeLimit'] = $copy_size_limit;
58+
}
59+
3460
if (getenv('OBJECTSTORE_S3_KEY_FILE')) {
3561
$CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));
3662
} elseif (getenv('OBJECTSTORE_S3_KEY')) {

README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Most Nextcloud Server administrative matters are covered in the official [Nextcl
3131
[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)
3232
[![Discourse Posts](https://img.shields.io/discourse/posts?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)
3333

34-
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they are bugs of course). This helps the
35-
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
34+
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they are bugs of course). This helps the
35+
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
3636
on the [community help forum](https://help.nextcloud.com/).)
3737

3838
For the image specifically, we provide [some simple deployment examples](https://github.com/nextcloud/docker/?tab=readme-ov-file#running-this-image-with-docker-compose) as well as some more extensive [deployment examples](https://github.com/nextcloud/docker/tree/master/.examples). In addition, the [community help forum](https://help.nextcloud.com/) has a "how-to" section with further examples of other peoples' container based Nextcloud stacks.
@@ -183,11 +183,11 @@ The `--private` flag can also be specified, in order to output all configuration
183183

184184
## Auto configuration via environment variables
185185

186-
The Nextcloud image supports auto configuration of the Nextcloud Server installation via environment variables. You can preconfigure everything that would otherwise be prompted for by the Nextcloud Installation Wizard (as well as a few other key parameters relevant to initial installation).
186+
The Nextcloud image supports auto configuration of the Nextcloud Server installation via environment variables. You can preconfigure everything that would otherwise be prompted for by the Nextcloud Installation Wizard (as well as a few other key parameters relevant to initial installation).
187187

188188
### Database parameters
189189

190-
To enable auto configuration, define your database connection via the following environment variables. If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_HOST`), they will not be requested via the Installation Wizard on first run.
190+
To enable auto configuration, define your database connection via the following environment variables. If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_HOST`), they will not be requested via the Installation Wizard on first run.
191191

192192
You must specify all of the environment variables for a given database or the database environment variables defaults to SQLITE. ONLY use one database type!
193193

@@ -271,8 +271,8 @@ Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/adm
271271

272272
### Object Storage (Primary Storage)
273273

274-
By default, Nextcloud stores all files in `/var/www/html/data/` (or whatever custom data directory you've configured). Nextcloud also allows the use of object storages (like OpenStack
275-
Swift or any Amazon S3-compatible implementation) as *Primary Storage*. This semi-replaces the default storage of files in the data directory. Note: This data directory might still be
274+
By default, Nextcloud stores all files in `/var/www/html/data/` (or whatever custom data directory you've configured). Nextcloud also allows the use of object storages (like OpenStack
275+
Swift or any Amazon S3-compatible implementation) as *Primary Storage*. This semi-replaces the default storage of files in the data directory. Note: This data directory might still be
276276
used for compatibility reasons and still needs to exist. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html) for more information.
277277

278278
To use an external S3 compatible object store as primary storage, set the following variables:
@@ -289,13 +289,15 @@ To use an external S3 compatible object store as primary storage, set the follow
289289
- `OBJECTSTORE_S3_OBJECT_PREFIX` (default: `urn:oid:`): Prefix to prepend to the fileid
290290
- `OBJECTSTORE_S3_AUTOCREATE` (default: `true`): Create the container if it does not exist
291291
- `OBJECTSTORE_S3_SSE_C_KEY` (not set by default): Base64 encoded key with a maximum length of 32 bytes for server side encryption (SSE-C)
292-
- `OBJECTSTORE_S3_CONCURRENCY` (default: `''`) defines the maximum number of concurrent multipart uploads
293-
- `OBJECTSTORE_S3_PROXY` (default: `''`)
294-
- `OBJECTSTORE_S3_TIMEOUT` (default: `''`)
295-
- `OBJECTSTORE_S3_UPLOADPARTSIZE` (default: `''`)
296-
- `OBJECTSTORE_S3_PUTSIZELIMIT` (default: `''`)
297-
- `OBJECTSTORE_S3_VERSION` (default: `''`)
298-
- `OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS` (default: `''`)
292+
- `OBJECTSTORE_S3_CONCURRENCY` defines the maximum number of concurrent multipart uploads
293+
- `OBJECTSTORE_S3_PROXY` (default: `false`)
294+
- `OBJECTSTORE_S3_TIMEOUT` (not set by default)
295+
- `OBJECTSTORE_S3_UPLOADPARTSIZE` (not set by default)
296+
- `OBJECTSTORE_S3_PUTSIZELIMIT` (not set by default)
297+
- `OBJECTSTORE_S3_USEMULTIPARTCOPY` (default: `false`)
298+
- `OBJECTSTORE_S3_COPYSIZELIMIT` (not set by default)
299+
- `OBJECTSTORE_S3_VERSION` (default: `latest`)
300+
- `OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS` (default: `true`) Setting this to `false` after confirming the bucket has been created may provide a performance benefit, but may not be possible in multibucket scenarios.
299301

300302
Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) for more information.
301303

@@ -509,9 +511,9 @@ Then run `docker compose up -d`, now you can access Nextcloud at http://localhos
509511

510512
# Docker Secrets
511513

512-
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files.
514+
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files.
513515

514-
Currently, this is only supported for `NEXTCLOUD_ADMIN_PASSWORD`, `NEXTCLOUD_ADMIN_USER`, `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`, `POSTGRES_DB`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, `REDIS_HOST_PASSWORD`, `SMTP_PASSWORD`, `OBJECTSTORE_S3_KEY`, and `OBJECTSTORE_S3_SECRET`.
516+
Currently, this is only supported for `NEXTCLOUD_ADMIN_PASSWORD`, `NEXTCLOUD_ADMIN_USER`, `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`, `POSTGRES_DB`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, `REDIS_HOST_PASSWORD`, `SMTP_PASSWORD`, `OBJECTSTORE_S3_KEY`, and `OBJECTSTORE_S3_SECRET`.
515517

516518
If you set any group of `_FILE` based values (i.e. all of `MYSQL_DATABASE_FILE`, `MYSQL_USER_FILE`, `MYSQL_PASSWORD_FILE`), their non-`_FILE` counterparts will be ignored (`MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`).
517519

@@ -590,7 +592,7 @@ We recommend using a reverse proxy in front of your Nextcloud installation. Your
590592
In our [examples](https://github.com/nextcloud/docker/tree/master/.examples) section we have an example for a fully automated setup using a reverse proxy, a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling, database and Nextcloud. It uses the popular [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [acme-companion](https://github.com/nginx-proxy/acme-companion) containers. Please check the according documentations before using this setup.
591593

592594
# First use
593-
When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account username, password and the database connection (unless of course you've provided all the necessary auto-config config values ahead of time).
595+
When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account username, password and the database connection (unless of course you've provided all the necessary auto-config config values ahead of time).
594596

595597
For the database use `db` as host and `nextcloud` as table and user name. Also enter the password you chose in your `compose.yaml` file.
596598

@@ -747,7 +749,7 @@ You're already using Nextcloud and want to switch to docker? Great! Here are som
747749

748750
## Migrating from a non-Alpine image to an Alpine image
749751

750-
If you already use one of our non-Alpine images, but want to switch to an Alpine-based image, you may experience permissions problems with your existing volumes. This is because the Alpine images uses a different user ID for `www-data`.
752+
If you already use one of our non-Alpine images, but want to switch to an Alpine-based image, you may experience permissions problems with your existing volumes. This is because the Alpine images uses a different user ID for `www-data`.
751753
So, you must change the ownership of the `/var/www/html` (or `$NEXTCLOUD_DATA_DIR`) folder to be compatible with Alpine:
752754

753755
```console
@@ -758,9 +760,9 @@ After changing the permissions, restart the container and the permission errors
758760

759761
# Reporting bugs or suggesting enhancements
760762

761-
If you believe you've found a bug in the image itself (or have an enhancement idea specific to the image), please [search for already reported bugs and enhancement ideas](https://github.com/nextcloud/docker/issues).
763+
If you believe you've found a bug in the image itself (or have an enhancement idea specific to the image), please [search for already reported bugs and enhancement ideas](https://github.com/nextcloud/docker/issues).
762764

763-
If there is a relevant existing open issue, you can either add to the discussion there or upvote it to indicate you're impacted by (or interested in) the same issue.
765+
If there is a relevant existing open issue, you can either add to the discussion there or upvote it to indicate you're impacted by (or interested in) the same issue.
764766

765767
If you believe you've found a new bug, please create a new Issue so that others can try to reproduce it and remediation can be tracked.
766768

@@ -769,8 +771,8 @@ If you believe you've found a new bug, please create a new Issue so that others
769771
![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/enhancement?style=flat&label=Enhancement%20Ideas&color=green)
770772
![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/good%20first%20issue?style=flat&label=Good%20First%20Issues)
771773

772-
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they really are bugs of course). This helps the
773-
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
774+
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they really are bugs of course). This helps the
775+
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
774776
on the [Nextcloud Community Help Forum](https://help.nextcloud.com).)
775777

776778
[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)

0 commit comments

Comments
 (0)