@@ -142,6 +142,7 @@ http {
142142 {{ $affinityArg := .deis_router_affinityArg }}
143143 {{ $certs := .deis_certs }}
144144 {{ $domains := .deis_domains }}
145+ {{ $root := . }}
145146 {{ range $service := .deis_services }}{{ if $service .Nodes }}
146147 upstream {{ Base $service .Key }} {
147148 {{ if $affinityArg }} hash $arg_ {{ $affinityArg }} consistent;
@@ -155,18 +156,26 @@ http {
155156 {{ range $domain := $domains }}{{ if eq ( Base $service .Key) $domain .Value }}
156157 server {
157158 server_name {{ Base $domain .Key }} ;
159+ {{ /* if a SSL certificate is installed for this domain, use SSL */}}
160+ {{ /* NOTE ( bacongobbler) : domains are separate from the default platform domain, */}}
161+ {{ /* so we can't rely on deis.conf as each domain is an island */}}
162+ {{ /* FIXME ( bacongobbler) : confd turns hyphens to dashes, so we need to account */}}
163+ {{ /* for that in domains */}}
164+ {{ if index $root ( printf "deis_certs_%s_cert" ( Replace ( Base $domain .Key) "-" "_" -1)) }}
158165 server_name_in_redirect off;
159166 port_in_redirect off;
160167 listen 80 ;
161- {{ /* if a SSL certificate is installed for this domain, use SSL */}}
162- {{ /* Note ( bacongobbler) : domains are separate from the default platform domain, */}}
163- {{ /* so we can't rely on deis.conf as each domain is an island */}}
164- {{ range $cert := $certs }}{{ if eq ( Base $domain .Key) ( Base $cert .Key) }}
165168 listen 443 ssl spdy;
166169 ssl_certificate /etc/ssl /deis/certs/{{ Base $domain .Key }} .cert;
167170 ssl_certificate_key /etc/ssl /deis/keys/{{ Base $domain .Key }} .key;
168171 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
169- {{ end }}{{ end }}
172+ {{ /* if there's no app SSL cert but we have a router SSL cert, enable that instead */}}
173+ {{ /* TODO ( bacongobbler) : wait for https://github.com/kelseyhightower/confd/issues/270 */}}
174+ {{ /* so we can apply this config to just subdomains of the platform domain. */}}
175+ {{ /* ref: https://github.com/deis/deis/pull/3519 */}}
176+ {{ else }}
177+ include deis.conf;
178+ {{ end }}
170179
171180 {{ if $service .Nodes }}
172181 location / {
0 commit comments