feat: allow limiting letsencrypt to certain domains when using openresty as a proxy

This commit is contained in:
Jose Diaz-Gonzalez
2024-03-06 03:31:51 -05:00
parent a1bd258f99
commit b8c67329ff
6 changed files with 127 additions and 4 deletions

View File

@@ -26,6 +26,12 @@ fn-openresty-access-log-path() {
fn-plugin-property-get-default "openresty" "$APP" "access-log-path" "${OPENRESTY_LOG_ROOT}/${APP}-access.log"
}
fn-fn-openresty-allowed-letsencrypt-domains-func-base64() {
declare desc="get the configured allowed domains func base64"
fn-plugin-property-get-default "openresty" "--global" "allowed-letsencrypt-domains-func-base64" "return true" | base64 -w 0
}
fn-openresty-bind-address-ipv4() {
declare desc="get the configured ipv4 bind address"
declare APP="$1"
@@ -221,6 +227,11 @@ fn-openresty-template-compose-file() {
OPENRESTY_LETSENCRYPT_EMAIL="$(fn-openresty-letsencrypt-email)"
OPENRESTY_LETSENCRYPT_SERVER="$(fn-openresty-letsencrypt-server)")
local ALLOWED_DOMAINS_FUNC_BASE64="$(fn-fn-openresty-allowed-letsencrypt-domains-func-base64)"
if [[ -n "$ALLOWED_DOMAINS_FUNC_BASE64" ]]; then
SIGIL_PARAMS+=(ALLOWED_DOMAINS_FUNC_BASE64="$ALLOWED_DOMAINS_FUNC_BASE64")
fi
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
}