feat(cr): disable error_log per domain
parent
c03f6848f4
commit
74cbe3a279
|
@ -103,6 +103,7 @@ THE SOFTWARE.
|
||||||
v-model="errorLogPath"
|
v-model="errorLogPath"
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
|
:disabled="!errorLogPathEnabled"
|
||||||
:placeholder="$props.data.errorLogPath.default"
|
:placeholder="$props.data.errorLogPath.default"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -153,7 +154,7 @@ THE SOFTWARE.
|
||||||
<script>
|
<script>
|
||||||
import delegatedFromDefaults from '../../util/delegated_from_defaults';
|
import delegatedFromDefaults from '../../util/delegated_from_defaults';
|
||||||
import computedFromDefaults from '../../util/computed_from_defaults';
|
import computedFromDefaults from '../../util/computed_from_defaults';
|
||||||
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogLevelDefault, errorLogLevelOptions } from '../../util/logging';
|
import { accessLogPathDefault, accessLogParamsDefault, errorLogPathDefault, errorLogLevelDefault, errorLogLevelOptions, errorLogLevelDisabled } from '../../util/logging';
|
||||||
import PrettyCheck from '../inputs/checkbox';
|
import PrettyCheck from '../inputs/checkbox';
|
||||||
import PrettyRadio from '../inputs/radio';
|
import PrettyRadio from '../inputs/radio';
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ THE SOFTWARE.
|
||||||
},
|
},
|
||||||
errorLogLevel: {
|
errorLogLevel: {
|
||||||
default: errorLogLevelDefault,
|
default: errorLogLevelDefault,
|
||||||
options: errorLogLevelOptions,
|
options: [errorLogLevelDisabled, ...errorLogLevelOptions],
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
redirectErrorLog: {
|
redirectErrorLog: {
|
||||||
|
@ -206,5 +207,20 @@ THE SOFTWARE.
|
||||||
data: Object, // Data delegated back to us from parent
|
data: Object, // Data delegated back to us from parent
|
||||||
},
|
},
|
||||||
computed: computedFromDefaults(defaults, 'logging'), // Getters & setters for the delegated data
|
computed: computedFromDefaults(defaults, 'logging'), // Getters & setters for the delegated data
|
||||||
|
watch: {
|
||||||
|
'$props.data.errorLogLevel': {
|
||||||
|
handler(data) {
|
||||||
|
// disable `error_log` path selection if log level is set to `none`
|
||||||
|
if (data.computed === errorLogLevelDisabled) {
|
||||||
|
this.$props.data.errorLogPath.enabled = false;
|
||||||
|
this.$props.data.errorLogPath.value = '/dev/null';
|
||||||
|
} else if (!this.$props.data.errorLogPath.enabled) {
|
||||||
|
this.$props.data.errorLogPath.enabled = true;
|
||||||
|
this.$props.data.errorLogPath.value = this.$props.data.errorLogPath.default;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,7 +40,9 @@ export const getDomainErrorLog = (domain) => {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path = `/var/log/nginx/${domain.server.domain.computed}.error.log`;
|
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';
|
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 errorLogPathDefault = '/var/log/nginx/error.log';
|
||||||
export const errorLogLevelDefault = 'warn';
|
export const errorLogLevelDefault = 'warn';
|
||||||
export const errorLogLevelOptions = Object.freeze(['debug', 'info', 'notice', 'warn', 'error', 'crit', 'alert', 'emerg']);
|
export const errorLogLevelOptions = Object.freeze(['debug', 'info', 'notice', 'warn', 'error', 'crit', 'alert', 'emerg']);
|
||||||
|
export const errorLogLevelDisabled = 'none';
|
||||||
|
|
Loading…
Reference in New Issue