aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bffe/server.scm32
1 files changed, 32 insertions, 0 deletions
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