From: Christopher Baines <mail@cbaines.net>
To: 56164@debbugs.gnu.org
Subject: [bug#56164] [PATCH] services: nginx: Add support for extra content in upstream blocks.
Date: Thu, 23 Jun 2022 12:45:00 +0100 [thread overview]
Message-ID: <20220623114500.13409-1-mail@cbaines.net> (raw)
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.
---
doc/guix.texi | 3 +++
gnu/services/web.scm | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index bbb7d0764d..0a96ad1852 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -28490,6 +28490,9 @@ prefix @samp{unix:}. For addresses using an IP address or domain name,
the default port is 80, and a different port can be specified
explicitly.
+@item @code{extra-content}
+A string or list of strings to add to the upstream block.
+
@end table
@end deftp
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>
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>
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)
--
2.36.1
next reply other threads:[~2022-06-23 11:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 11:45 Christopher Baines [this message]
2022-07-01 8:48 ` bug#56164: [PATCH] services: nginx: Add support for extra content in upstream blocks Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220623114500.13409-1-mail@cbaines.net \
--to=mail@cbaines.net \
--cc=56164@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).