diff --git a/services/traccar.sh b/services/traccar.sh index 5db6323..e74cf57 100644 --- a/services/traccar.sh +++ b/services/traccar.sh @@ -216,15 +216,22 @@ install_traccar() { local TZ_VAL="${SITE_TZ:-$(cat /etc/timezone 2>/dev/null || echo UTC)}" + # Mirrors configure_caddy_for_service's own mode resolution (lib/common.sh) + # so this matches whatever Caddy setup the site actually has: an explicit + # CADDY_MODE from the site config wins, then a local ~/docker/caddy, then + # the legacy CADDY_REMOTE_HOST var. Only "local" joins caddy_net — a remote + # Caddy box can't resolve container names on this host's bridge network + # anyway, it reaches Traccar via this host's published 8082 port instead. + local _CADDY_MODE="${CADDY_MODE:-none}" + [ "$_CADDY_MODE" = "none" ] && [ -d "$DOCKER_DIR/caddy" ] && _CADDY_MODE="local" + [ "$_CADDY_MODE" = "none" ] && [ -n "${CADDY_REMOTE_HOST:-}" ] && _CADDY_MODE="remote" + local _CADDY_NET_BLOCK="" - if [ -d "$DOCKER_DIR/caddy" ]; then + local _CADDY_NET_SECTION="" + if [ "$_CADDY_MODE" = "local" ]; then _CADDY_NET_BLOCK=" networks: - caddy_net " - fi - - local _CADDY_NET_SECTION="" - if [ -d "$DOCKER_DIR/caddy" ]; then _CADDY_NET_SECTION=" networks: caddy_net: