chore: update letsencrypt plugin to 0.25.2

Vendored copy refreshed from dokku/dokku-letsencrypt master (0.20.4 ->
0.25.2), keeping the same set of files the fork vendors (no tests,
Makefile, or CI workflow).
This commit is contained in:
apple committed 2026-11-14 14:51:34 +08:00
1 parent ef2f6012e1
commit 424232c5af
13 files changed
+1011 -233

No files matched your search

+73 -21
View File
@@ -40,12 +40,12 @@ cmd-letsencrypt-auto-renew() {
# if we should hit a rate limit along the way.
# Store the list in a temporary file to avoid subshell issues with pipelines
local temp_file=$(mktemp)
fn-letsencrypt-list-apps-with-expiry | sort -nk5 > "$temp_file"
fn-letsencrypt-list-apps-with-expiry --quiet | sort -nk5 > "$temp_file"
while IFS=$'\t' read -r -a appExpiry; do
if [[ ${appExpiry[4]} -lt 0 ]]; then
dokku_log_info1 "${appExpiry[0]} needs renewal"
if ! dokku letsencrypt:enable "${appExpiry[0]}"; then
if ! (fn-letsencrypt-enable "${appExpiry[0]}"); then
EXIT_CODE=1
fi
else
@@ -74,7 +74,7 @@ cmd-letsencrypt-auto-renew() {
if [[ $time_to_renewal -lt 0 ]]; then
dokku_log_info2 "Auto-renew ${APP}..."
dokku letsencrypt:enable "$APP"
fn-letsencrypt-enable "$APP"
else
days_left=$(fn-letsencrypt-format-timediff $time_to_renewal)
dokku_log_verbose "$APP still has $days_left left before renewal"
@@ -128,8 +128,16 @@ cmd-letsencrypt-cron-job() {
fn-letsencrypt-cron-job-add
elif [[ "$FLAG" == "--remove" ]]; then
fn-letsencrypt-cron-job-remove
elif [[ -z "$FLAG" ]]; then
if [[ "$(fn-letsencrypt-is-autorenew-enabled)" == "true" ]]; then
dokku_log_info2_quiet "Auto-renew cron job is enabled"
dokku_log_verbose "Run 'dokku letsencrypt:cron-job --remove' to disable."
else
dokku_log_info2_quiet "Auto-renew cron job is not enabled"
dokku_log_verbose "Run 'dokku letsencrypt:cron-job --add' to enable."
fi
else
dokku_log_verbose "Specify --add or --remove to modify the cron-job"
dokku_log_fail "Invalid flag '${FLAG}', specify --add, --remove, or no flag to display status."
fi
}
@@ -164,16 +172,31 @@ cmd-letsencrypt-enable() {
declare cmd="letsencrypt:enable"
[[ "$1" == "$cmd" ]] && shift 1
local FORCE=false
local positional=()
local arg
for arg in "$@"; do
case "$arg" in
--force | -f)
FORCE=true
;;
*)
positional+=("$arg")
;;
esac
done
set -- "${positional[@]}"
# Support --app/$DOKKU_APP_NAME flag by reordering args into "$cmd $DOKKU_APP_NAME $@"
[[ -n "$DOKKU_APP_NAME" ]] && set -- $DOKKU_APP_NAME $@
declare APP="$1"
if [[ "$APP" == "--all" ]]; then
for app in $(dokku_apps); do
fn-letsencrypt-enable "$app"
fn-letsencrypt-enable "$app" "$FORCE"
done
else
fn-letsencrypt-enable "$APP"
fn-letsencrypt-enable "$APP" "$FORCE"
fi
}
@@ -198,34 +221,43 @@ cmd-letsencrypt-report() {
declare desc="displays a letsencrypt report for one or more apps"
declare cmd="letsencrypt:report"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" INFO_FLAG="$2"
local INSTALLED_APPS
INSTALLED_APPS=$(dokku_apps)
fn-letsencrypt-report-parse-args "$@"
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi
if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do
cmd-letsencrypt-report-single "$app" "$INFO_FLAG" | tee || true
if [[ "$APP" == "--global" ]]; then
cmd-letsencrypt-report-single "$APP" "$INFO_FLAG" "$REPORT_FORMAT"
elif [[ -z "$APP" ]]; then
for app in $(dokku_apps); do
cmd-letsencrypt-report-single "$app" "$INFO_FLAG" "$REPORT_FORMAT" | tee || true
done
else
cmd-letsencrypt-report-single "$APP" "$INFO_FLAG"
cmd-letsencrypt-report-single "$APP" "$INFO_FLAG" "$REPORT_FORMAT"
fi
}
cmd-letsencrypt-report-single() {
declare APP="$1" INFO_FLAG="$2"
declare APP="$1" INFO_FLAG="$2" FORMAT="${3:-stdout}"
if [[ "$INFO_FLAG" == "true" ]]; then
INFO_FLAG=""
fi
verify_app_name "$APP"
if [[ "$APP" != "--global" ]]; then
verify_app_name "$APP"
fi
local flag_map=(
"--letsencrypt-active: $(fn-letsencrypt-is-active "$APP")"
"--letsencrypt-autorenew: $(fn-letsencrypt-is-autorenew-enabled "$APP")"
@@ -239,16 +271,36 @@ cmd-letsencrypt-report-single() {
"--letsencrypt-computed-graceperiod: $(fn-letsencrypt-computed-graceperiod "$APP")"
"--letsencrypt-global-graceperiod: $(fn-letsencrypt-global-graceperiod)"
"--letsencrypt-graceperiod: $(fn-letsencrypt-graceperiod "$APP")"
"--letsencrypt-computed-lego-docker-args: $(fn-letsencrypt-computed-lego-docker-args "$APP")"
"--letsencrypt-global-lego-docker-args: $(fn-letsencrypt-global-lego-docker-args)"
"--letsencrypt-lego-docker-args: $(fn-letsencrypt-lego-docker-args "$APP")"
"--letsencrypt-computed-lego-args: $(fn-letsencrypt-computed-lego-args "$APP")"
"--letsencrypt-global-lego-args: $(fn-letsencrypt-global-lego-args)"
"--letsencrypt-lego-args: $(fn-letsencrypt-lego-args "$APP")"
"--letsencrypt-computed-lego-docker-options: $(fn-letsencrypt-computed-lego-docker-options "$APP")"
"--letsencrypt-global-lego-docker-options: $(fn-letsencrypt-global-lego-docker-options)"
"--letsencrypt-lego-docker-options: $(fn-letsencrypt-lego-docker-options "$APP")"
"--letsencrypt-computed-server: $(fn-letsencrypt-computed-server "$APP")"
"--letsencrypt-global-server: $(fn-letsencrypt-global-server)"
"--letsencrypt-server: $(fn-letsencrypt-server "$APP")"
)
fn-letsencrypt-report-add-dns-provider-keys flag_map "$APP"
if [[ "$APP" == "--global" ]]; then
fn-letsencrypt-report-filter-global flag_map
fi
fn-letsencrypt-report-validate-format "$FORMAT" "$INFO_FLAG"
if [[ "$FORMAT" == "json" ]]; then
fn-letsencrypt-report-emit-json flag_map
return
fi
if [[ -z "$INFO_FLAG" ]]; then
dokku_log_info2_quiet "${APP} letsencrypt information"
if [[ "$APP" == "--global" ]]; then
dokku_log_info2_quiet "global letsencrypt information"
else
dokku_log_info2_quiet "${APP} letsencrypt information"
fi
for flag in "${flag_map[@]}"; do
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
@@ -297,13 +349,13 @@ cmd-letsencrypt-set() {
declare cmd="letsencrypt:set"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("dns-provider" "email" "graceperiod" "server" "lego-docker-args")
local VALID_KEYS=("dns-provider" "email" "graceperiod" "server" "lego-args" "lego-docker-options")
[[ "$APP" == "--global" ]] || verify_app_name "$APP"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}" && [[ "$KEY" != dns-provider-* ]]; then
dokku_log_fail "Invalid key specified, valid keys include: dns-provider, dns-provider-*, email, graceperiod, server, lego-docker-args"
dokku_log_fail "Invalid key specified, valid keys include: dns-provider, dns-provider-*, email, graceperiod, server, lego-args, lego-docker-options"
fi
if [[ -n "$VALUE" ]]; then