From b5c6062bcec9530a9c4044a1bd1091fdebf9bc74 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 23 Jun 2022 12:38:37 +0100 Subject: services: nginx: Add support for extra content in upstream blocks. I'm looking at this as I'd like to use the keepalive functionality. * gnu/services/web.scm (nginx-upstream-configuration-extra-content): New procedure. (emit-nginx-upstream-config): Include the extra-content if applicable. * doc/guix.texi (NGINX): Document this. --- gnu/services/web.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 4f06d4e0bb..4434fecf02 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -120,6 +120,7 @@ (define-module (gnu services web) nginx-upstream-configuration? nginx-upstream-configuration-name nginx-upstream-configuration-servers + nginx-upstream-configuration-extra-content nginx-location-configuration nginx-location-configuration? @@ -517,7 +518,9 @@ (define-record-type* nginx-upstream-configuration make-nginx-upstream-configuration nginx-upstream-configuration? (name nginx-upstream-configuration-name) - (servers nginx-upstream-configuration-servers)) + (servers nginx-upstream-configuration-servers) + (extra-content nginx-upstream-configuration-extra-content + (default '()))) (define-record-type* nginx-location-configuration make-nginx-location-configuration @@ -643,6 +646,15 @@ (define (emit-nginx-upstream-config upstream) (map (lambda (server) (simple-format #f " server ~A;\n" server)) (nginx-upstream-configuration-servers upstream)) + (let ((extra-content + (nginx-upstream-configuration-extra-content upstream))) + (if (and extra-content (not (null? extra-content))) + (cons + "\n" + (map (lambda (line) + (simple-format #f " ~A\n" line)) + (flatten extra-content))) + '())) " }\n")) (define (flatten . lst) -- cgit v1.2.3