From 1b706b4b6535e0b394e8815dea3f014ed08c5a40 Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Mon, 17 Jul 2023 22:18:57 +0200 Subject: [PATCH] Use correct internal URL for fetching logs In a setup where internal traffic is meant to stay internal (i.e. the `internal-origin` config is used) fetching logs is currently broken. The logs are served by the api component, but as is the request will be sent to the Python frontend. Fix this by using the value of `api-origin`, just falling back to `get_origin` if that is not set. This is the same technique already employed in the Python GraphQL client. Signed-off-by: Conrad Hoffmann --- buildsrht/blueprints/jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildsrht/blueprints/jobs.py b/buildsrht/blueprints/jobs.py index d552b29..52cca88 100644 --- a/buildsrht/blueprints/jobs.py +++ b/buildsrht/blueprints/jobs.py @@ -488,7 +488,7 @@ def job_by_id(username, job_id): set_cache(cachekey, timedelta(days=2), json.dumps(log)) logs.append(log) return log["more"] - origin = get_origin("builds.sr.ht") + origin = cfg("builds.sr.ht", "api-origin", default=get_origin("builds.sr.ht")) log_url = f"{origin}/query/log/{job.id}/log" if get_log(log_url, None, job.status): for task in sorted(job.tasks, key=lambda t: t.id): -- 2.38.5