summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2017-08-02 15:52:36 +0100
committerChristopher Baines <mail@cbaines.net>2017-08-17 18:32:27 +0100
commitf2d7a492df759ab7416ff4b244e37896835f04fa (patch)
tree92e4cf04e3cafd5278fcd0099de8a540e2aefbe1 /gnu
parentc9aa261be48a2463022faf5bea1854503a5ba7d7 (diff)
downloadguix-f2d7a492df759ab7416ff4b244e37896835f04fa.tar.gz
web: Check for the existance of SSL related files.
This adds back the previous behaviour of the nginx-service-type, where the
service would check at the time when the configuration is generated if the SSL
certificate and certificate key file exists.

* gnu/services/web.scm (emit-nginx-server-config): Add back check for SSL
  related files.
Diffstat (limited to 'gnu')
-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 97318ecb12..cc7adeb5e4 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -157,6 +157,16 @@ of index files."
             (syntax-parameterize ((<> (identifier-syntax x*)))
               (list tail ...))
             '())))
+    (for-each
+     (match-lambda
+      ((record-key . file)
+       (if (and file (not (file-exists? file)))
+           (error
+            (simple-format
+             #f
+             "~A in the nginx configuration for the server with name \"~A\" does not exist" record-key server-name)))))
+     `(("ssl-certificate"     . ,ssl-certificate)
+       ("ssl-certificate-key" . ,ssl-certificate-key)))
     (list
      "    server {\n"
      (and/l http-port  "      listen " (number->string <>) ";\n")