Skip to content

Commit

Permalink
Fix initialization of autocreate and use_ssl (#2309)
Browse files Browse the repository at this point in the history
According to the documentation, both `OBJECTSTORE_S3_SSL` and
`OBJECTSTORE_S3_AUTOCREATE` should default to `true`.
Currently, when these environment variables are not set, they default to
`false`. (See #2308).

This fix works, because `strtolower(false)` returns the empty string. So
when `OBJECTSTORE_S3_SSL` is not set and `getenv('OBJECTSTORE_S3_SSL')`
returns `false`, the check `strtolower($use_ssl) !== 'false'` will
evaluate to `true`.

With this fix, both values will be `true` if they are

* not set
* the empty string
* any string that is not equal to `false` when converted to lowercase

This should now match the documented behavior.

Signed-off-by: Valentin Brandl <mail@vbrandl.net>
  • Loading branch information
vbrandl authored Oct 24, 2024
1 parent aaa667a commit d3341b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .config/s3.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',
'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',
'objectPrefix' => getenv("OBJECTSTORE_S3_OBJECT_PREFIX") ? getenv("OBJECTSTORE_S3_OBJECT_PREFIX") : "urn:oid:",
'autocreate' => (strtolower($autocreate) === 'false' || $autocreate == false) ? false : true,
'use_ssl' => (strtolower($use_ssl) === 'false' || $use_ssl == false) ? false : true,
'autocreate' => strtolower($autocreate) !== 'false',
'use_ssl' => strtolower($use_ssl) !== 'false',
// required for some non Amazon S3 implementations
'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',
// required for older protocol versions
Expand Down

0 comments on commit d3341b6

Please sign in to comment.