From ec2ad44de08163a388ba6bce602fed5634b5b08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:11:44 +0200 Subject: [PATCH 1/2] feat(config): expose log.conditions via OWNCLOUD_LOG_CONDITIONS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ownCloud core's 'log.conditions' (documented in config.apps.sample.php) is a list of condition maps mixing scalar and array values (apps, users, logfile, loglevel, shared_secret). The flat env-var idioms used elsewhere in config.php (explode/parse_str) cannot represent this nested structure, so it had no env-var equivalent in the image. Expose it through a single JSON-encoded env var. A json_decode result that is not an array (malformed JSON) is ignored so a bad value cannot break config generation. Applied to all three versions (v20.04, v22.04, v24.04). Co-Authored-By: Claude Opus 4.8 Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> --- v20.04/overlay/etc/templates/config.php | 12 ++++++++++++ v22.04/overlay/etc/templates/config.php | 12 ++++++++++++ v24.04/overlay/etc/templates/config.php | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/v20.04/overlay/etc/templates/config.php b/v20.04/overlay/etc/templates/config.php index 2d81903..d2730f5 100644 --- a/v20.04/overlay/etc/templates/config.php +++ b/v20.04/overlay/etc/templates/config.php @@ -253,6 +253,18 @@ function getConfigFromEnv() { $config['log_rotate_size'] = (int) getenv('OWNCLOUD_LOG_ROTATE_SIZE'); } + // 'log.conditions' is a list of condition maps with mixed scalar/array + // values (apps, users, logfile, loglevel, shared_secret), which the flat + // env-var idioms used elsewhere here cannot represent. It is therefore + // passed as a JSON-encoded array, e.g.: + // OWNCLOUD_LOG_CONDITIONS='[{"apps":["files_external"],"loglevel":0}]' + if (getenv('OWNCLOUD_LOG_CONDITIONS') != '') { + $logConditions = json_decode(getenv('OWNCLOUD_LOG_CONDITIONS'), true); + if (is_array($logConditions)) { + $config['log.conditions'] = $logConditions; + } + } + if (getenv('OWNCLOUD_ENABLE_PREVIEWS') != '') { $config['enable_previews'] = getenv('OWNCLOUD_ENABLE_PREVIEWS') === 'true'; } diff --git a/v22.04/overlay/etc/templates/config.php b/v22.04/overlay/etc/templates/config.php index 2d81903..d2730f5 100644 --- a/v22.04/overlay/etc/templates/config.php +++ b/v22.04/overlay/etc/templates/config.php @@ -253,6 +253,18 @@ function getConfigFromEnv() { $config['log_rotate_size'] = (int) getenv('OWNCLOUD_LOG_ROTATE_SIZE'); } + // 'log.conditions' is a list of condition maps with mixed scalar/array + // values (apps, users, logfile, loglevel, shared_secret), which the flat + // env-var idioms used elsewhere here cannot represent. It is therefore + // passed as a JSON-encoded array, e.g.: + // OWNCLOUD_LOG_CONDITIONS='[{"apps":["files_external"],"loglevel":0}]' + if (getenv('OWNCLOUD_LOG_CONDITIONS') != '') { + $logConditions = json_decode(getenv('OWNCLOUD_LOG_CONDITIONS'), true); + if (is_array($logConditions)) { + $config['log.conditions'] = $logConditions; + } + } + if (getenv('OWNCLOUD_ENABLE_PREVIEWS') != '') { $config['enable_previews'] = getenv('OWNCLOUD_ENABLE_PREVIEWS') === 'true'; } diff --git a/v24.04/overlay/etc/templates/config.php b/v24.04/overlay/etc/templates/config.php index 7622cfd..fe38444 100644 --- a/v24.04/overlay/etc/templates/config.php +++ b/v24.04/overlay/etc/templates/config.php @@ -306,6 +306,18 @@ function getConfigFromEnv() { $config['log_rotate_size'] = (int) getenv('OWNCLOUD_LOG_ROTATE_SIZE'); } + // 'log.conditions' is a list of condition maps with mixed scalar/array + // values (apps, users, logfile, loglevel, shared_secret), which the flat + // env-var idioms used elsewhere here cannot represent. It is therefore + // passed as a JSON-encoded array, e.g.: + // OWNCLOUD_LOG_CONDITIONS='[{"apps":["files_external"],"loglevel":0}]' + if (getenv('OWNCLOUD_LOG_CONDITIONS') != '') { + $logConditions = json_decode(getenv('OWNCLOUD_LOG_CONDITIONS'), true); + if (is_array($logConditions)) { + $config['log.conditions'] = $logConditions; + } + } + if (getenv('OWNCLOUD_ENABLE_PREVIEWS') != '') { $config['enable_previews'] = getenv('OWNCLOUD_ENABLE_PREVIEWS') === 'true'; } From 0d324afedc88d5c7680aea2e8a439e7318a9eb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:47:04 +0200 Subject: [PATCH 2/2] docs: document OWNCLOUD_LOG_CONDITIONS in ENVIRONMENT.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> --- ENVIRONMENT.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md index c9b78a2..68dbf46 100644 --- a/ENVIRONMENT.md +++ b/ENVIRONMENT.md @@ -165,6 +165,8 @@ Define additional login buttons on the logon screen (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-additional-login-buttons-on-the-logon-screen)). - `OWNCLOUD_LOGIN_POLICY_ORDER=` \ Ordered list of login policy class names. Comma-separated (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-additional-login-buttons-on-the-logon-screen)). +- `OWNCLOUD_LOG_CONDITIONS=` \ + Define conditional logging rules as a JSON-encoded array of condition objects, e.g. `[{"apps":["files_external"],"loglevel":0}]` (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-log-conditions)). - `OWNCLOUD_LOG_DATE_FORMAT=` \ Define the log date format (see [documentation](https://doc.owncloud.com/server/latest/admin_manual/configuration/server/config_sample_php_parameters.html#define-the-log-date-format)). - `OWNCLOUD_LOG_FILE=${OWNCLOUD_VOLUME_FILES}/owncloud.log` \