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.
This commit is contained in:
Christopher Baines 2017-08-02 15:52:36 +01:00
parent c9aa261be4
commit f2d7a492df
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
1 changed files with 10 additions and 0 deletions

View File

@ -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")