From 74cbe3a27967b2f6f90cde6e7eee633b1c28cf4b Mon Sep 17 00:00:00 2001 From: Kobi Meirson Date: Sat, 5 Nov 2022 17:15:09 +0200 Subject: [PATCH] feat(cr): disable error_log per domain --- .../templates/domain_sections/logging.vue | 20 +++++++++++++++++-- src/nginxconfig/util/logging.js | 5 ++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/nginxconfig/templates/domain_sections/logging.vue b/src/nginxconfig/templates/domain_sections/logging.vue index 1deecb5..8610b22 100644 --- a/src/nginxconfig/templates/domain_sections/logging.vue +++ b/src/nginxconfig/templates/domain_sections/logging.vue @@ -103,6 +103,7 @@ THE SOFTWARE. v-model="errorLogPath" class="input" type="text" + :disabled="!errorLogPathEnabled" :placeholder="$props.data.errorLogPath.default" /> @@ -153,7 +154,7 @@ THE SOFTWARE. diff --git a/src/nginxconfig/util/logging.js b/src/nginxconfig/util/logging.js index 516184c..ed7777f 100644 --- a/src/nginxconfig/util/logging.js +++ b/src/nginxconfig/util/logging.js @@ -40,7 +40,9 @@ export const getDomainErrorLog = (domain) => { if (!path) { path = `/var/log/nginx/${domain.server.domain.computed}.error.log`; } - return `${path} ${domain.logging.errorLogLevel.computed}`; + + const errorLogLevel = errorLogLevelOptions.includes(domain.logging.errorLogLevel.computed) ? ` ${domain.logging.errorLogLevel.computed}` : ''; + return `${path}${errorLogLevel}`; }; export const accessLogPathDefault = '/var/log/nginx/access.log'; @@ -49,3 +51,4 @@ export const accessLogParamsDefault = 'buffer=512k flush=1m'; export const errorLogPathDefault = '/var/log/nginx/error.log'; export const errorLogLevelDefault = 'warn'; export const errorLogLevelOptions = Object.freeze(['debug', 'info', 'notice', 'warn', 'error', 'crit', 'alert', 'emerg']); +export const errorLogLevelDisabled = 'none';