services: nginx: Support extra content in the http block.

This helpful when adding content to the nginx configuration file, which isn't
supported by the record type used for the configuration.  For example, like
adding proxy_cache_path configuration.

* gnu/packages/web.scm (<nginx-configuration>): Add new extra-content field.
  (nginx-configuration-extra-content): New field accessor.
  (default-nginx-config): Add support for the extra-content field.
* doc/guix.texi (NGINX): Document the new extra-content field.
master
Christopher Baines 2018-02-16 18:19:42 +00:00
parent bea07c7f55
commit 25e071ead9
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
2 changed files with 11 additions and 2 deletions

View File

@ -15938,6 +15938,10 @@ use the size of the processors cache line.
@item @code{server-names-hash-bucket-max-size} (default: @code{#f}) @item @code{server-names-hash-bucket-max-size} (default: @code{#f})
Maximum bucket size for the server names hash tables. Maximum bucket size for the server names hash tables.
@item @code{extra-content} (default: @code{""})
Extra content for the @code{http} block. Should be string or a string
valued G-expression.
@end table @end table
@end deffn @end deffn

View File

@ -77,6 +77,7 @@
nginx-configuration-upstream-blocks nginx-configuration-upstream-blocks
nginx-configuration-server-names-hash-bucket-size nginx-configuration-server-names-hash-bucket-size
nginx-configuration-server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size
nginx-configuration-extra-content
nginx-configuration-file nginx-configuration-file
<nginx-server-configuration> <nginx-server-configuration>
@ -431,6 +432,8 @@
(default #f)) (default #f))
(server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size (server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size
(default #f)) (default #f))
(extra-content nginx-configuration-extra-content
(default ""))
(file nginx-configuration-file ;#f | string | file-like (file nginx-configuration-file ;#f | string | file-like
(default #f))) (default #f)))
@ -521,7 +524,8 @@ of index files."
(nginx log-directory run-directory (nginx log-directory run-directory
server-blocks upstream-blocks server-blocks upstream-blocks
server-names-hash-bucket-size server-names-hash-bucket-size
server-names-hash-bucket-max-size) server-names-hash-bucket-max-size
extra-content)
(apply mixed-text-file "nginx.conf" (apply mixed-text-file "nginx.conf"
(flatten (flatten
"user nginx nginx;\n" "user nginx nginx;\n"
@ -550,7 +554,8 @@ of index files."
"\n" "\n"
(map emit-nginx-upstream-config upstream-blocks) (map emit-nginx-upstream-config upstream-blocks)
(map emit-nginx-server-config server-blocks) (map emit-nginx-server-config server-blocks)
"}\n" extra-content
"\n}\n"
"events {}\n")))) "events {}\n"))))
(define %nginx-accounts (define %nginx-accounts