mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
b1594a8b1c
This PR does two small things: 1. The log level, in case it is unset, will now be "calculated" from `/etc/dms-settings` and not always default to `info`. This way, we can ensure that more often than not, the log level the user chose when starting DMS is used everywhere. 2. I noticed that the way I obtained the log level could be used to obtain any env variable's log level. I therefore added a function to `utils.sh` in case we use it in the future.
23 lines
487 B
Bash
23 lines
487 B
Bash
#! /bin/bash
|
|
|
|
function _escape
|
|
{
|
|
echo "${1//./\\.}"
|
|
}
|
|
|
|
# Check if string input is an empty line, only whitespaces
|
|
# or `#` as the first non-whitespace character.
|
|
function _is_comment
|
|
{
|
|
grep -q -E "^\s*$|^\s*#" <<< "${1}"
|
|
}
|
|
|
|
# Provide the name of an environment variable to this function
|
|
# and it will return its value stored in /etc/dms-settings
|
|
function _get_dms_env_value
|
|
{
|
|
local VALUE
|
|
VALUE=$(grep "^${1}=" /etc/dms-settings | cut -d '=' -f 2)
|
|
printf '%s' "${VALUE:1:-1}"
|
|
}
|