mealie: reconcile BASE_URL with the domain actually chosen at the Caddy prompt
Confirmed live: install_mealie() pre-computes BASE_URL as recipes<suffix>.$SITE_DOMAIN before ever asking about Caddy, then configure_caddy_for_service() separately prompts for a domain — which the user can freely override (e.g. typing mealie.mydomain.com instead of accepting the recipes.mydomain.com default). Nothing fed that choice back into BASE_URL, so it stayed stale. Since BASE_URL is exactly what _mealie_offer_authelia_oidc() registers as the OIDC redirect URI, this produced Authelia's "redirect_uri does not match any of the OAuth 2.0 Client's pre-registered redirect_uris" — Caddy and DNS were both correctly pointed at the new domain, but the client Authelia had on file still said the old one. Added CADDY_SERVICE_DOMAIN as a new configure_caddy_for_service() out-param (lib/common.sh) — the same out-param convention as the existing CADDY_SERVICE_CONFIGURED/CADDY_SERVICE_MODE, set right after the domain prompt is accepted. install_mealie() now reconciles BASE_URL against it immediately after the Caddy call, before the Authelia OIDC step reads BASE_URL back out of .env. ActualBudget's equivalent OIDC offer asks for its own domain fresh each time rather than reading a pre-computed BASE_URL, so it isn't affected by this class of bug and needs no equivalent fix. Verified the reconciliation logic in isolation against a synthetic .env.
This commit is contained in:
@@ -856,6 +856,7 @@ configure_caddy_for_service() {
|
||||
# already the only intended way in, instead of leaving both routes open.
|
||||
CADDY_SERVICE_CONFIGURED=false
|
||||
CADDY_SERVICE_MODE=""
|
||||
CADDY_SERVICE_DOMAIN=""
|
||||
|
||||
# Derive the proxy upstream and a port number for display messages.
|
||||
# Plain number → host.docker.internal:PORT (host-network or legacy
|
||||
@@ -916,6 +917,15 @@ configure_caddy_for_service() {
|
||||
if [ -z "$SERVICE_DOMAIN" ]; then
|
||||
echo " ⚠ No domain provided, skipping Caddy configuration."; return 0
|
||||
fi
|
||||
# Set as soon as we know a domain was actually accepted — every path below
|
||||
# this point that returns 0 without configuring Caddy is a genuine failure
|
||||
# (write/reload error), not "no domain chosen", so leaving this set is
|
||||
# correct: the caller can tell CADDY_SERVICE_CONFIGURED apart from whether
|
||||
# a domain was entered at all. Callers that pre-compute their own default
|
||||
# URL/domain before calling this (e.g. services/mealie.sh's BASE_URL) need
|
||||
# this to reconcile against whatever the user actually typed here, which
|
||||
# can differ from that pre-computed default.
|
||||
CADDY_SERVICE_DOMAIN="$SERVICE_DOMAIN"
|
||||
|
||||
# Build the site block — upstream differs by mode
|
||||
local _BLOCK_UPSTREAM="$_UPSTREAM"
|
||||
|
||||
Reference in New Issue
Block a user