0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-04-19 18:36:09 +02:00

#2340 Introduce env var OBJECTSTORE_S3_LIKE_SERVICE_ENDPOINT_URL

This commit is contained in:
Marco Descher 2024-11-26 14:25:39 +01:00
parent 61fb34da5f
commit 4a869e0d5e

View file

@ -4,14 +4,25 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) {
$use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');
$use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');
$autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');
$endpointUrl = getenv('OBJECTSTORE_S3_LIKE_SERVICE_ENDPOINT_URL');
$hostname = '';
$port = '';
if ($endpointUrl) {
$parsedUrl = parse_url($endpointUrl);
$hostname = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
$port = isset($parsedUrl['port']) ? $parsedUrl['port'] : '';
} else {
$hostname = getenv('OBJECTSTORE_S3_HOST') ?: '';
$port = getenv('OBJECTSTORE_S3_PORT') ?: '';
}
$CONFIG = array(
'objectstore' => array(
'class' => '\OC\Files\ObjectStore\S3',
'arguments' => array(
'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),
'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',
'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',
'port' => getenv('OBJECTSTORE_S3_PORT') ?: '',
'hostname' => $hostname,
'port' => $port,
'storageClass' => getenv('OBJECTSTORE_S3_STORAGE_CLASS') ?: '',
'objectPrefix' => getenv("OBJECTSTORE_S3_OBJECT_PREFIX") ? getenv("OBJECTSTORE_S3_OBJECT_PREFIX") : "urn:oid:",
'autocreate' => strtolower($autocreate) !== 'false',