diff --git a/.ds.baseline b/.ds.baseline index c303c3c45..fd261c5cf 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -171,7 +171,7 @@ "filename": "app/config.py", "hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc", "is_verified": false, - "line_number": 120, + "line_number": 122, "is_secret": false } ], @@ -644,5 +644,5 @@ } ] }, - "generated_at": "2025-05-12T16:50:20Z" + "generated_at": "2025-05-19T21:41:23Z" } diff --git a/app/__init__.py b/app/__init__.py index 441ff5dd4..0b2006689 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -141,7 +141,7 @@ navigation = { def _csp(config): asset_domain = config["ASSET_DOMAIN"] logo_domain = config["LOGO_CDN_DOMAIN"] - api_host_name = config["API_HOST_NAME"] + api_public_url = config["API_PUBLIC_URL"] csp = { "default-src": ["'self'", asset_domain], @@ -172,14 +172,14 @@ def _csp(config): "img-src": ["'self'", asset_domain, logo_domain], } - if api_host_name: - csp["connect-src"].append(api_host_name) + if api_public_url: + csp["connect-src"].append(api_public_url) # this is for web socket - if api_host_name.startswith("http://"): - ws_url = api_host_name.replace("http://", "ws://") + if api_public_url.startswith("http://"): + ws_url = api_public_url.replace("http://", "ws://") csp["connect-src"].append(ws_url) - elif api_host_name.startswith("https://"): - ws_url = api_host_name.replace("https://", "wss://") + elif api_public_url.startswith("https://"): + ws_url = api_public_url.replace("https://", "wss://") csp["connect-src"].append(ws_url) return csp diff --git a/app/config.py b/app/config.py index 20381e499..e4c1d310a 100644 --- a/app/config.py +++ b/app/config.py @@ -12,6 +12,8 @@ class Config(object): NOTIFY_APP_NAME = "admin" NOTIFY_ENVIRONMENT = getenv("NOTIFY_ENVIRONMENT", "development") API_HOST_NAME = getenv("API_HOST_NAME", "localhost") + API_PUBLIC_URL = getenv("API_PUBLIC_URL", "localhost") + ADMIN_BASE_URL = getenv("ADMIN_BASE_URL", "http://localhost:6012") HEADER_COLOUR = ( "#81878b" # mix(govuk-colour("dark-grey"), govuk-colour("mid-grey")) diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index c0c639046..d4ed28c18 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -58,11 +58,11 @@ def view_job(service_id, job_id): filter_args = parse_filter_args(request.args) filter_args["status"] = set_status_filters(filter_args) - api_host_name = os.environ.get("API_HOST_NAME") + api_public_url = os.environ.get("API_PUBLIC_URL") return render_template( "views/jobs/job.html", - api_host_name=api_host_name, + api_public_url=api_public_url, FEATURE_SOCKET_ENABLED=current_app.config["FEATURE_SOCKET_ENABLED"], job=job, status=request.args.get("status", ""), diff --git a/app/templates/views/jobs/job.html b/app/templates/views/jobs/job.html index 2ae2d76c1..f9a6a3fed 100644 --- a/app/templates/views/jobs/job.html +++ b/app/templates/views/jobs/job.html @@ -14,7 +14,7 @@ {% if not job.finished_processing %}
This page refreshes automatically to show the latest message activity delivery rates, details, and reports.
You can watch it in progress or check back later.