summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-09-06 16:12:56 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-06 16:58:12 +0200
commit8c5065c6d1036012996e4812788e48ca74bc1294 (patch)
treeea25f45645332c8d50e4857fc4d9e32782b09091 /gnu/services
parent61b63e7fa73be8828af2b36d196c3676c974e119 (diff)
downloadguix-8c5065c6d1036012996e4812788e48ca74bc1294.tar.gz
services: nginx: Add 'shepherd-requirement' configuration field.
* gnu/services/web.scm (<nginx-configuration>)[shepherd-requirement]:
New field.
(nginx-shepherd-service): Honor it.
* doc/guix.texi (Web Services): Document it.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/web.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index f0c7e90cbf..b144cf7076 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -93,6 +93,7 @@
             nginx-configuration
             nginx-configuration?
             nginx-configuration-nginx
+            nginx-configuration-shepherd-requirement
             nginx-configuration-log-directory
             nginx-configuration-run-directory
             nginx-configuration-server-blocks
@@ -556,6 +557,8 @@
   nginx-configuration?
   (nginx         nginx-configuration-nginx          ;file-like
                  (default nginx))
+  (shepherd-requirement nginx-configuration-shepherd-requirement
+                        (default '()))              ;list of symbols
   (log-directory nginx-configuration-log-directory  ;string
                  (default "/var/log/nginx"))
   (run-directory nginx-configuration-run-directory  ;string
@@ -779,7 +782,7 @@ of index files."
 (define (nginx-shepherd-service config)
   (match-record config
                 <nginx-configuration>
-                (nginx file run-directory)
+                (nginx file run-directory shepherd-requirement)
    (let* ((nginx-binary (file-append nginx "/sbin/nginx"))
           (pid-file (in-vicinity run-directory "pid"))
           (nginx-action
@@ -803,7 +806,7 @@ of index files."
      (list (shepherd-service
             (provision '(nginx))
             (documentation "Run the nginx daemon.")
-            (requirement '(user-processes loopback))
+            (requirement `(user-processes loopback ,@shepherd-requirement))
             (modules `((ice-9 match)
                        ,@%default-modules))
             (start (nginx-action "-p" run-directory))