Skip to content

feat(Config.php): change array_merge to array_replace_recursive when merging configs - #57371

Merged
Altahrim merged 1 commit into
masterfrom
enh/noid/change-config-to-amr
Jan 7, 2026
Merged

feat(Config.php): change array_merge to array_replace_recursive when merging configs#57371
Altahrim merged 1 commit into
masterfrom
enh/noid/change-config-to-amr

Conversation

@szaimen

@szaimenszaimen commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Consider an s3.config.php file for initial installation like this:

Expand
<?php
$use_ssl = getenv('OBJECTSTORE_S3_SSL');
$use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');
$use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');
$autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');
$multibucket = getenv('OBJECTSTORE_S3_MULTIBUCKET');
$CONFIG = array(
'objectstore' => array(
'class' => '\OC\Files\ObjectStore\S3',
'arguments' => array(
'multibucket' => $multibucket === 'true',
'bucket' => getenv('OBJECTSTORE_S3_BUCKET'),
'key' => getenv('OBJECTSTORE_S3_KEY') ?: '',
'secret' => getenv('OBJECTSTORE_S3_SECRET') ?: '',
'region' => getenv('OBJECTSTORE_S3_REGION') ?: '',
'hostname' => getenv('OBJECTSTORE_S3_HOST') ?: '',
'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',
'use_ssl' => strtolower($use_ssl) !== 'false',
// required for some non Amazon S3 implementations
'use_path_style' => strtolower($use_path) === 'true',
// required for older protocol versions
'legacy_auth' => strtolower($use_legacyauth) === 'true',
'use_nextcloud_bundle' => 1,
)
)
);
$sse_c_key = getenv('OBJECTSTORE_S3_SSE_C_KEY');
if ($sse_c_key) {
$CONFIG['objectstore']['arguments']['sse_c_key'] = $sse_c_key;
}

Now, you want to add additional perBucket settings using the occ command

php occ config:system:set --value=test objectstore arguments perBucket test1 secret
php occ config:system:set --value=test objectstore arguments perBucket test2 secret

It will not work without this PR.

@szaimenszaimen added this to the Nextcloud 33 milestone Jan 6, 2026
@szaimenszaimen added enhancement 3. to review Waiting for reviews labels Jan 6, 2026
@szaimen

Copy link
Copy Markdown
ContributorAuthor

/backport to stable32

@szaimen

Copy link
Copy Markdown
ContributorAuthor

/backport to stable31

@szaimen

Copy link
Copy Markdown
ContributorAuthor

/backport to stable30

…hen merging configs
Signed-off-by: Simon L. <szaimen@e.mail.de>
@szaimen
szaimenforce-pushed the enh/noid/change-config-to-amr branch from 4e006c7 to 178fb77CompareJanuary 6, 2026 15:03
@szaimenszaimen changed the title feat(Config.php): change array_merge to array_merge_recursive when merging configsfeat(Config.php): change array_merge to array_replace_recursive when merging configsJan 6, 2026
@szaimen
szaimen marked this pull request as ready for review January 6, 2026 15:27
@szaimen
szaimen requested a review from a team as a code ownerJanuary 6, 2026 15:27
@szaimen
szaimen requested review from leftybournes, salmart-dev and yemkareems and removed request for a teamJanuary 6, 2026 15:27
@szaimenszaimen mentioned this pull request Jan 6, 2026
@nextcloud-botnextcloud-bot mentioned this pull request Jan 7, 2026
@Altahrim
Altahrim merged commit 351351a into masterJan 7, 2026
229 of 244 checks passed
@Altahrim
Altahrim deleted the enh/noid/change-config-to-amr branch January 7, 2026 11:04
@AltahrimAltahrim removed the 3. to review Waiting for reviews label Jan 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@szaimen@icewind1991@Altahrim@CarlSchwan