From 214d44ca66fddfda5c23560de6fbd5d541caadb9 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 29 Apr 2023 11:22:15 +0200 Subject: Reverse proxy the build, agent and agent allocation plan responses From the coordinator. This is so the bffe can render pages based on this data. --- bffe/server.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'bffe') diff --git a/bffe/server.scm b/bffe/server.scm index 8157843..cf1fa30 100644 --- a/bffe/server.scm +++ b/bffe/server.scm @@ -344,6 +344,7 @@ (define* (make-controller assets-directory metrics-registry events-channel state-channel + event-source title template-directory) @@ -430,6 +431,36 @@ (and=> (assoc-ref query-parameters "last_event_id") string->number))) #:unwind? #t)))))) + (('GET "build" uuid) + (let ((response + body + (http-get + (string->uri + (string-append event-source "/build/" uuid))))) + (render-json + (json-string->scm + (utf8->string body))))) + (('GET "agent" agent-id) + (let ((response + body + (http-get + (string->uri + (string-append event-source "/agent/" agent-id))))) + (render-json + (json-string->scm + (utf8->string body))))) + (('GET "agent" agent-id (or "build-allocation-plan" + ;; TODO Remove underscore variant + "build_allocation_plan")) + (let ((response + body + (http-get + (string->uri + (string-append event-source "/agent/" agent-id + "/build_allocation_plan"))))) + (render-json + (json-string->scm + (utf8->string body))))) (('GET "assets" rest ...) (or (handle-static-assets (string-join rest "/") @@ -506,6 +537,7 @@ (apply make-controller assets-directory metrics-registry events-channel state-channel + event-source controller-args))) ;; Wait until the events channel catches up -- cgit v1.2.3