From cde177966dacf3d35cb398752f8824024a65d407 Mon Sep 17 00:00:00 2001 From: Dmitrii Iurco Date: Tue, 26 May 2026 14:50:28 -0400 Subject: [PATCH] fix: DDNS URL env var takes priority; switch default to HTTPS - ddns_manager: DDNS_URL env var overrides stored api_base_url so existing cells pick up the new HTTPS endpoint without re-registering - docker-compose.yml: default DDNS_URL now points to https://ddns.pic.ngo - setup_manager.py: add rstrip('/') before replacing /api/v1 to handle URLs with or without trailing slash Co-Authored-By: Claude Sonnet 4.6 --- api/ddns_manager.py | 4 +++- api/setup_manager.py | 2 +- docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/ddns_manager.py b/api/ddns_manager.py index 4daf008..165042a 100644 --- a/api/ddns_manager.py +++ b/api/ddns_manager.py @@ -344,7 +344,9 @@ class DDNSManager(BaseServiceManager): return None if provider_name == 'pic_ngo': - api_base = ddns_cfg.get('api_base_url') + # Env var takes priority so deployments can switch URLs without re-registering + _env_url = os.environ.get('DDNS_URL', '').replace('/api/v1', '').rstrip('/') + api_base = _env_url or ddns_cfg.get('api_base_url') totp_secret = ddns_cfg.get('totp_secret') or os.environ.get('DDNS_TOTP_SECRET', '') return PicNgoDDNS(api_base_url=api_base, totp_secret=totp_secret) diff --git a/api/setup_manager.py b/api/setup_manager.py index 5d5c6bb..3999510 100644 --- a/api/setup_manager.py +++ b/api/setup_manager.py @@ -60,7 +60,7 @@ VALID_DOMAIN_MODES = {'pic_ngo', 'cloudflare', 'duckdns', 'http01', 'lan'} CELL_NAME_RE = re.compile(r'^[a-z][a-z0-9-]{1,30}$') -DDNS_API_BASE = os.environ.get('DDNS_URL', 'https://ddns.pic.ngo/api/v1').replace('/api/v1', '') +DDNS_API_BASE = os.environ.get('DDNS_URL', 'https://ddns.pic.ngo/api/v1').rstrip('/').replace('/api/v1', '') DDNS_TOTP_SECRET = os.environ.get('DDNS_TOTP_SECRET', '') diff --git a/docker-compose.yml b/docker-compose.yml index 9751a50..da9d422 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -205,7 +205,7 @@ services: ports: - "127.0.0.1:${API_PORT:-3000}:3000" environment: - - DDNS_URL=${DDNS_URL:-http://ddns.pic.ngo:8080/api/v1} + - DDNS_URL=${DDNS_URL:-https://ddns.pic.ngo/api/v1} - DDNS_TOTP_SECRET=${DDNS_TOTP_SECRET:-S6UMA464YIKM74QHXWL5WELDIO3HFZ6K} volumes: - ./data/api:/app/data