services: nginx: Allow to add raw content to the server blocks.

* doc/guix.texi (Web Services): Document 'raw-content'.
* gnu/services/web.scm (<nginx-server-configuration>)[raw-content]: New field.
(emit-nginx-server-config): Add it.
This commit is contained in:
Clément Lassieur 2017-12-09 22:47:53 +01:00
parent 8b223ceac4
commit b05e8ee120
No known key found for this signature in database
GPG Key ID: 89F96D4808F359C7
2 changed files with 10 additions and 2 deletions

View File

@ -14979,6 +14979,9 @@ you don't have a key or you don't want to use HTTPS.
@item @code{server-tokens?} (default: @code{#f}) @item @code{server-tokens?} (default: @code{#f})
Whether the server should add its configuration to response. Whether the server should add its configuration to response.
@item @code{raw-content} (default: @code{'()})
A list of raw lines added to the server block.
@end table @end table
@end deftp @end deftp

View File

@ -58,6 +58,7 @@
nginx-server-configuration-ssl-certificate nginx-server-configuration-ssl-certificate
nginx-server-configuration-ssl-certificate-key nginx-server-configuration-ssl-certificate-key
nginx-server-configuration-server-tokens? nginx-server-configuration-server-tokens?
nginx-server-configuration-raw-content
<nginx-upstream-configuration> <nginx-upstream-configuration>
nginx-upstream-configuration nginx-upstream-configuration
@ -152,7 +153,9 @@
(ssl-certificate-key nginx-server-configuration-ssl-certificate-key (ssl-certificate-key nginx-server-configuration-ssl-certificate-key
(default #f)) (default #f))
(server-tokens? nginx-server-configuration-server-tokens? (server-tokens? nginx-server-configuration-server-tokens?
(default #f))) (default #f))
(raw-content nginx-server-configuration-raw-content
(default '())))
(define-record-type* <nginx-upstream-configuration> (define-record-type* <nginx-upstream-configuration>
nginx-upstream-configuration make-nginx-upstream-configuration nginx-upstream-configuration make-nginx-upstream-configuration
@ -232,7 +235,8 @@ of index files."
(index (nginx-server-configuration-index server)) (index (nginx-server-configuration-index server))
(try-files (nginx-server-configuration-try-files server)) (try-files (nginx-server-configuration-try-files server))
(server-tokens? (nginx-server-configuration-server-tokens? server)) (server-tokens? (nginx-server-configuration-server-tokens? server))
(locations (nginx-server-configuration-locations server))) (locations (nginx-server-configuration-locations server))
(raw-content (nginx-server-configuration-raw-content server)))
(define-syntax-parameter <> (syntax-rules ())) (define-syntax-parameter <> (syntax-rules ()))
(define-syntax-rule (and/l x tail ...) (define-syntax-rule (and/l x tail ...)
(let ((x* x)) (let ((x* x))
@ -255,6 +259,7 @@ of index files."
"\n" "\n"
(map emit-nginx-location-config locations) (map emit-nginx-location-config locations)
"\n" "\n"
(map (lambda (x) (list " " x "\n")) raw-content)
" }\n"))) " }\n")))
(define (emit-nginx-upstream-config upstream) (define (emit-nginx-upstream-config upstream)