Ensure cert exists before referencing it

This commit is contained in:
Jason Wilder 2014-12-02 23:29:00 -07:00
parent 35b81f5092
commit 0580726415

View file

@ -79,7 +79,7 @@ upstream {{ $host }} {
{{/* Use the cert specifid on the container or fallback to the best vhost match */}}
{{ $cert := (coalesce $certName $vhostCert) }}
{{ if (ne $cert "") }}
{{ if (and (ne $cert "") (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert))) }}
server {
server_name {{ $host }};