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 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 14:50:28 -04:00
parent 61e8631c7d
commit cde177966d
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -344,7 +344,9 @@ class DDNSManager(BaseServiceManager):
return None return None
if provider_name == 'pic_ngo': 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', '') 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) return PicNgoDDNS(api_base_url=api_base, totp_secret=totp_secret)
+1 -1
View File
@@ -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}$') 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', '') DDNS_TOTP_SECRET = os.environ.get('DDNS_TOTP_SECRET', '')
+1 -1
View File
@@ -205,7 +205,7 @@ services:
ports: ports:
- "127.0.0.1:${API_PORT:-3000}:3000" - "127.0.0.1:${API_PORT:-3000}:3000"
environment: 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} - DDNS_TOTP_SECRET=${DDNS_TOTP_SECRET:-S6UMA464YIKM74QHXWL5WELDIO3HFZ6K}
volumes: volumes:
- ./data/api:/app/data - ./data/api:/app/data