me
/
guix
Archived
1
0
Fork 0

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.
master
Christopher Baines 2022-06-23 12:38:37 +01:00
parent 9a2a77b6ad
commit b5c6062bce
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
2 changed files with 16 additions and 1 deletions

View File

@ -28531,6 +28531,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 the default port is 80, and a different port can be specified
explicitly. explicitly.
@item @code{extra-content}
A string or list of strings to add to the upstream block.
@end table @end table
@end deftp @end deftp

View File

@ -120,6 +120,7 @@
nginx-upstream-configuration? nginx-upstream-configuration?
nginx-upstream-configuration-name nginx-upstream-configuration-name
nginx-upstream-configuration-servers nginx-upstream-configuration-servers
nginx-upstream-configuration-extra-content
nginx-location-configuration nginx-location-configuration
nginx-location-configuration? nginx-location-configuration?
@ -517,7 +518,9 @@
nginx-upstream-configuration make-nginx-upstream-configuration nginx-upstream-configuration make-nginx-upstream-configuration
nginx-upstream-configuration? nginx-upstream-configuration?
(name nginx-upstream-configuration-name) (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> (define-record-type* <nginx-location-configuration>
nginx-location-configuration make-nginx-location-configuration nginx-location-configuration make-nginx-location-configuration
@ -643,6 +646,15 @@ of index files."
(map (lambda (server) (map (lambda (server)
(simple-format #f " server ~A;\n" server)) (simple-format #f " server ~A;\n" server))
(nginx-upstream-configuration-servers upstream)) (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")) " }\n"))
(define (flatten . lst) (define (flatten . lst)