mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-06-24 17:58:58 +02:00
refactoring: split helper functions into smaller scripts (#2420)
This commit is contained in:
parent
2927cc47c7
commit
b61dfe1e24
41 changed files with 389 additions and 396 deletions
8
target/scripts/helpers/ssl.sh
Normal file → Executable file
8
target/scripts/helpers/ssl.sh
Normal file → Executable file
|
@ -94,7 +94,7 @@ function _setup_ssl
|
|||
# 2020 feature intended for Traefik v2 support only:
|
||||
# https://github.com/docker-mailserver/docker-mailserver/pull/1553
|
||||
# Extracts files `key.pem` and `fullchain.pem`.
|
||||
# `_extract_certs_from_acme` is located in `helper-functions.sh`
|
||||
# `_extract_certs_from_acme` is located in `helpers/ssl.sh`
|
||||
# NOTE: See the `SSL_TYPE=letsencrypt` case below for more details.
|
||||
function _traefik_support
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ function _setup_ssl
|
|||
# SSL_DOMAIN will have any wildcard prefix stripped for the output FQDN folder it is stored in.
|
||||
# TODO: A wildcard cert needs to be provisioned via Traefik to validate if acme.json contains any other value for `main` or `sans` beyond the wildcard.
|
||||
#
|
||||
# NOTE: HOSTNAME is set via `helper-functions.sh`, it is not the original system HOSTNAME ENV anymore.
|
||||
# NOTE: HOSTNAME is set via `helpers/dns.sh`, it is not the original system HOSTNAME ENV anymore.
|
||||
# TODO: SSL_DOMAIN is Traefik specific, it no longer seems relevant and should be considered for removal.
|
||||
|
||||
_traefik_support
|
||||
|
@ -407,7 +407,6 @@ function _setup_ssl
|
|||
|
||||
esac
|
||||
}
|
||||
export -f _setup_ssl
|
||||
|
||||
function _extract_certs_from_acme
|
||||
{
|
||||
|
@ -441,13 +440,11 @@ function _extract_certs_from_acme
|
|||
|
||||
_notify 'inf' "_extract_certs_from_acme | Certificate successfully extracted for '${CERT_DOMAIN}'"
|
||||
}
|
||||
export -f _extract_certs_from_acme
|
||||
|
||||
# Remove the `*.` prefix if it exists, else returns the input value
|
||||
function _strip_wildcard_prefix {
|
||||
[[ ${1} == "*."* ]] && echo "${1:2}" || echo "${1}"
|
||||
}
|
||||
export -f _strip_wildcard_prefix
|
||||
|
||||
# Compute checksums of monitored files,
|
||||
# returned output on `stdout`: hash + filepath tuple on each line
|
||||
|
@ -496,4 +493,3 @@ function _monitored_files_checksums
|
|||
|
||||
sha512sum -- "${CHANGED_FILES[@]}"
|
||||
}
|
||||
export -f _monitored_files_checksums
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue