1
0
mirror of https://github.com/docker-mailserver/docker-mailserver.git synced 2025-06-16 03:40:36 +02:00

chore(housekeeping): Normalize how config files filter out unwanted lines (#2619)

* chore(`aliases.sh`): Filepath to local var `DATABASE_VIRTUAL`

* chore(`accounts.sh`): Filepath to local var `DATABASE_ACCOUNTS`

* chore(`accounts.sh`): Filepath to local var `DATABASE_VIRTUAL`

* chore(`accounts.sh`): Filepath to local var `DATABASE_DOVECOT_MASTERS`

* chore(`bin/open-dkim`): Filepaths to local vars (accounts,virtual,vhost)

* chore(`relay.sh`): Filepath to local var `DATABASE_SASL_PASSWD`

* chore: Rename method

Prior PR feedback suggested a better helper method name.

* chore: Normalize filtering config lines as input for iterating

* chore: Remove `_is_comment` helper method

No longer serving a purpose with more appropriate filter method for pre-processing the entire config file.
This commit is contained in:
Brennan Kinney
2022-06-07 01:07:30 +12:00
committed by GitHub
parent fa8bfdc22a
commit 54904aa02c
9 changed files with 51 additions and 60 deletions

View File

@ -7,19 +7,11 @@ function _escape
# Returns input after filtering out lines that are:
# empty, white-space, comments (`#` as the first non-whitespace character)
function _filter_to_valid_lines
function _get_valid_lines_from_file
{
grep --extended-regexp --invert-match "^\s*$|^\s*#" "${1}" || true
}
# TODO: Only used by `relay.sh`, will be removed in future.
# Similar to _filter_to_valid_lines, but only returns a status code
# to indicate invalid line(s):
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