From 88752877adff0a409de0a15d0462288ccdcc0e9d Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 11 Jun 2025 11:07:08 +0200 Subject: [PATCH] IPv6 tidy-up Re #3248 --- .github/workflows/test-stack-reusable-workflow.yml | 9 +++++++++ changedetectionio/__init__.py | 7 +------ docker-compose.yml | 5 +++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-stack-reusable-workflow.yml b/.github/workflows/test-stack-reusable-workflow.yml index e3712e014..c5b1af959 100644 --- a/.github/workflows/test-stack-reusable-workflow.yml +++ b/.github/workflows/test-stack-reusable-workflow.yml @@ -190,6 +190,15 @@ jobs: docker kill test-changedetectionio-ssl + - name: Test IPv6 Mode + run: | + # IPv6 - :: bind to all interfaces inside container (like 0.0.0.0), ::1 would be localhost only + docker run --name test-changedetectionio-ipv6 --rm -p 5000:5000 -e LISTEN_HOST=:: -d test-changedetectionio + sleep 3 + # Should return 0 (no error) when grep finds it on localhost + curl --retry-connrefused --retry 6 http://[::1]:5000 -v|grep -q checkbox-uuid + docker kill test-changedetectionio-ipv6 + - name: Test changedetection.io SIGTERM and SIGINT signal shutdown run: | diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 5015dc865..89af55fd1 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -65,8 +65,7 @@ def main(): datastore_path = None do_cleanup = False - host = "0.0.0.0" - ipv6_enabled = False + host = os.environ.get("LISTEN_HOST", "0.0.0.0").strip() port = int(os.environ.get('PORT', 5000)) ssl_mode = False @@ -108,10 +107,6 @@ def main(): if opt == '-d': datastore_path = arg - if opt == '-6': - logger.success("Enabling IPv6 listen support") - ipv6_enabled = True - # Cleanup (remove text files that arent in the index) if opt == '-c': do_cleanup = True diff --git a/docker-compose.yml b/docker-compose.yml index e8b1f626c..f89e5f971 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,6 +74,11 @@ services: # ./cert.pem:/app/cert.pem and ./privkey.pem:/app/privkey.pem # - SSL_CERT_FILE=cert.pem # - SSL_PRIVKEY_FILE=privkey.pem + # + # LISTEN_HOST / "host", Same as -h + # - LISTEN_HOST=:: + # - LISTEN_HOST=0.0.0.0 + # Comment out ports: when using behind a reverse proxy , enable networks: etc. ports: