Skip to content

Commit fe9a538

Browse files
author
pvlg
authored
Replace "replace" to "trimSuffix"
I have a domain key-mydomain.com. When I add domain www.key-mydomain.com with ssl cert I did not get the desired result. Function replace cut name ssl cert "www.key-mydomain.com.key" to "www-mydomain.com".
1 parent f02bc98 commit fe9a538

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nginx.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ upstream {{ $host }} {
118118
{{ $vhostCert := (closest (dir "/etc/nginx/certs") (printf "%s.crt" $host))}}
119119

120120
{{/* vhostCert is actually a filename so remove any suffixes since they are added later */}}
121-
{{ $vhostCert := replace $vhostCert ".crt" "" -1 }}
122-
{{ $vhostCert := replace $vhostCert ".key" "" -1 }}
121+
{{ $vhostCert := trimSuffix ".crt" $vhostCert }}
122+
{{ $vhostCert := trimSuffix ".key" $vhostCert }}
123123

124124
{{/* Use the cert specified on the container or fallback to the best vhost match */}}
125125
{{ $cert := (coalesce $certName $vhostCert) }}

0 commit comments

Comments
 (0)