Skip to content
Snippets Groups Projects
Unverified Commit 0f4740f4 authored by Julien Lepiller's avatar Julien Lepiller
Browse files

gnu: services: nginx: Test certificate presence.

* gnu/services/web.scm (default-nginx-server-config): Test certificate
presence when https is requested at configure time.
parent 9416112e
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
;;; Copyright © 2015 David Thompson <davet@gnu.org> ;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is> ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
...@@ -154,12 +154,16 @@ (define (default-nginx-server-config server) ...@@ -154,12 +154,16 @@ (define (default-nginx-server-config server)
(nginx-server-configuration-server-name server)) (nginx-server-configuration-server-name server))
";\n" ";\n"
(if (nginx-server-configuration-ssl-certificate server) (if (nginx-server-configuration-ssl-certificate server)
(string-append " ssl_certificate " (let ((certificate (nginx-server-configuration-ssl-certificate server)))
(nginx-server-configuration-ssl-certificate server) ";\n") ;; lstat fails when the certificate file does not exist: it aborts
;; and lets the user fix their configuration.
(lstat certificate)
(string-append " ssl_certificate " certificate ";\n"))
"") "")
(if (nginx-server-configuration-ssl-certificate-key server) (if (nginx-server-configuration-ssl-certificate-key server)
(string-append " ssl_certificate_key " (let ((key (nginx-server-configuration-ssl-certificate-key server)))
(nginx-server-configuration-ssl-certificate-key server) ";\n") (lstat certificate)
(string-append " ssl_certificate_key " key ";\n"))
"") "")
" root " (nginx-server-configuration-root server) ";\n" " root " (nginx-server-configuration-root server) ";\n"
" index " (config-index-strings (nginx-server-configuration-index server)) ";\n" " index " (config-index-strings (nginx-server-configuration-index server)) ";\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment