fix: add MEALIE_INTERNAL_URL env var for Docker-to-Docker API calls

When deployed behind Cloudflare Tunnel, requests from the container to
the external Mealie URL fail with 530 (hairpin). MEALIE_INTERNAL_URL
lets the container use the Docker-internal address (e.g. http://mealie:9000)
for API calls while keeping the external URL for browser links.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 07:58:59 +01:00
parent 92912c5890
commit 9a59b38fd6
3 changed files with 13 additions and 7 deletions
+3 -2
View File
@@ -56,7 +56,7 @@ def settings_test():
if not url or not key:
return jsonify({"ok": False, "error": "Nincs megadva Mealie URL vagy API kulcs."})
try:
client = MealieClient(url, key)
client = MealieClient(url, key, api_url=config.MEALIE_INTERNAL_URL)
info = client.test_connection()
return jsonify({"ok": True, "data": info})
except Exception as exc:
@@ -98,7 +98,8 @@ def send_to_mealie():
return jsonify({"ok": False, "error": "Érvénytelen kérés."})
try:
client = MealieClient(cfg["mealie_url"], cfg["mealie_api_key"])
client = MealieClient(cfg["mealie_url"], cfg["mealie_api_key"],
api_url=config.MEALIE_INTERNAL_URL)
slug = client.create_recipe(payload)
recipe_url = f"{cfg['mealie_url']}/g/home/r/{slug}"
return jsonify({"ok": True, "slug": slug, "url": recipe_url})