nginx module: fix acme if vhost name != serverName

cc #21931 @bobvanderlinden
This commit is contained in:
Franz Pletz 2017-02-25 08:03:14 +01:00
parent e564a399d9
commit 3a4dd97c55
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4

View File

@ -5,13 +5,16 @@ with lib;
let
cfg = config.services.nginx;
virtualHosts = mapAttrs (vhostName: vhostConfig:
vhostConfig // {
let
serverName = if vhostConfig.serverName != null
then vhostConfig.serverName
else vhostName;
in
vhostConfig // {
inherit serverName;
} // (optionalAttrs vhostConfig.enableACME {
sslCertificate = "/var/lib/acme/${vhostName}/fullchain.pem";
sslCertificateKey = "/var/lib/acme/${vhostName}/key.pem";
sslCertificate = "/var/lib/acme/${serverName}/fullchain.pem";
sslCertificateKey = "/var/lib/acme/${serverName}/key.pem";
})
) cfg.virtualHosts;
enableIPv6 = config.networking.enableIPv6;