mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2026-02-25 20:25:24 +00:00
chore: Improve clarity of SSL_TYPE=self-signed error message (missing files) (#4658)
Removed ambiguity when an expected file to support this `SSL_TYPE` mode was missing. The error message is now dynamic so that it only displays what is missing, along with language that is more compatible to one vs multiple files. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: georglauterbach <44545919+georglauterbach@users.noreply.github.com> Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
@@ -35,7 +35,7 @@ function dms_panic() {
|
||||
;;
|
||||
|
||||
( 'no-file' ) # PANIC_INFO == <invalid filepath>
|
||||
SHUTDOWN_MESSAGE="File ${PANIC_INFO} does not exist!"
|
||||
SHUTDOWN_MESSAGE="Missing expected file(s): ${PANIC_INFO}"
|
||||
;;
|
||||
|
||||
( 'misconfigured' ) # PANIC_INFO == <something possibly misconfigured, eg an ENV var>
|
||||
|
||||
@@ -309,7 +309,15 @@ function _setup_ssl() {
|
||||
|
||||
_log 'trace' "SSL configured with 'self-signed' certificates"
|
||||
else
|
||||
_dms_panic__no_file "${SS_KEY} or ${SS_CERT} or ${SS_CA_CERT}" "${SCOPE_SSL_TYPE}"
|
||||
local MISSING_FILES=()
|
||||
[[ ! -f ${SS_KEY} ]] && MISSING_FILES+=("${SS_KEY}")
|
||||
[[ ! -f ${SS_CERT} ]] && MISSING_FILES+=("${SS_CERT}")
|
||||
[[ ! -f ${SS_CA_CERT} ]] && MISSING_FILES+=("${SS_CA_CERT}")
|
||||
|
||||
# Concatenate each element and delimit with ` + `:
|
||||
local ERROR_CONTEXT
|
||||
ERROR_CONTEXT=$(printf "'%s' + " "${MISSING_FILES[@]}" | sed 's/ + $//')
|
||||
_dms_panic__no_file "${ERROR_CONTEXT}" "${SCOPE_SSL_TYPE}"
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user