aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/web.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-03-15 12:03:57 +0100
committerRicardo Wurmus <rekado@elephly.net>2020-03-15 12:05:32 +0100
commitb420e6deb96e0760f12e3d941b76e690c4235e47 (patch)
treeb8d84b725bb10a3d5d1c60359a076dc97f2d5070 /gnu/services/web.scm
parent995b391013aa61c6e7d8d6b89d822542e155286b (diff)
downloadpatches-b420e6deb96e0760f12e3d941b76e690c4235e47.tar
patches-b420e6deb96e0760f12e3d941b76e690c4235e47.tar.gz
services/web: nginx-configuration: Add support for global directives.
* gnu/services/web.scm (<nginx-configuration>)[global-directives]: Add field. (emit-global-directive): New procedure. (default-nginx-config): Use it. * doc/guix.texi (Web Services): Document it.
Diffstat (limited to 'gnu/services/web.scm')
-rw-r--r--gnu/services/web.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index e2178faeb8..3edc751ea2 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -529,6 +529,7 @@
(server-names-hash-bucket-max-size nginx-configuration-server-names-hash-bucket-max-size
(default #f))
(modules nginx-configuration-modules (default '()))
+ (global-directives nginx-configuration-global-directives (default '()))
(extra-content nginx-configuration-extra-content
(default ""))
(file nginx-configuration-file ;#f | string | file-like
@@ -552,6 +553,13 @@ of index files."
(define (emit-load-module module)
(list "load_module " module ";\n"))
+(define emit-global-directive
+ (match-lambda
+ ((key . (? list? alist))
+ (format #f "~a { ~{~a~}}~%" key (map emit-global-directive alist)))
+ ((key . value)
+ (format #f "~a ~a;~%" key value))))
+
(define emit-nginx-location-config
(match-lambda
(($ <nginx-location-configuration> uri body)
@@ -626,12 +634,14 @@ of index files."
server-names-hash-bucket-size
server-names-hash-bucket-max-size
modules
+ global-directives
extra-content)
(apply mixed-text-file "nginx.conf"
(flatten
"user nginx nginx;\n"
"pid " run-directory "/pid;\n"
"error_log " log-directory "/error.log info;\n"
+ (map emit-global-directive global-directives)
(map emit-load-module modules)
"http {\n"
" client_body_temp_path " run-directory "/client_body_temp;\n"