mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-03 19:17:38 +03:00
nixos/httpd: add virtualHosts.<name>.listenAddresses option
This commit is contained in:
parent
57362d7d3c
commit
98e354074f
@ -36,11 +36,12 @@ let
|
|||||||
dependentCertNames = unique (map (hostOpts: hostOpts.certName) acmeEnabledVhosts);
|
dependentCertNames = unique (map (hostOpts: hostOpts.certName) acmeEnabledVhosts);
|
||||||
|
|
||||||
mkListenInfo = hostOpts:
|
mkListenInfo = hostOpts:
|
||||||
if hostOpts.listen != [] then hostOpts.listen
|
if hostOpts.listen != [] then
|
||||||
else (
|
hostOpts.listen
|
||||||
optional (hostOpts.onlySSL || hostOpts.addSSL || hostOpts.forceSSL) { ip = "*"; port = 443; ssl = true; } ++
|
else
|
||||||
optional (!hostOpts.onlySSL) { ip = "*"; port = 80; ssl = false; }
|
optionals (hostOpts.onlySSL || hostOpts.addSSL || hostOpts.forceSSL) (map (addr: { ip = addr; port = 443; ssl = true; }) hostOpts.listenAddresses) ++
|
||||||
);
|
optionals (!hostOpts.onlySSL) (map (addr: { ip = addr; port = 80; ssl = false; }) hostOpts.listenAddresses)
|
||||||
|
;
|
||||||
|
|
||||||
listenInfo = unique (concatMap mkListenInfo vhosts);
|
listenInfo = unique (concatMap mkListenInfo vhosts);
|
||||||
|
|
||||||
|
@ -47,12 +47,29 @@ in
|
|||||||
];
|
];
|
||||||
description = ''
|
description = ''
|
||||||
Listen addresses and ports for this virtual host.
|
Listen addresses and ports for this virtual host.
|
||||||
<note><para>
|
<note>
|
||||||
|
<para>
|
||||||
This option overrides <literal>addSSL</literal>, <literal>forceSSL</literal> and <literal>onlySSL</literal>.
|
This option overrides <literal>addSSL</literal>, <literal>forceSSL</literal> and <literal>onlySSL</literal>.
|
||||||
</para></note>
|
</para>
|
||||||
|
<para>
|
||||||
|
If you only want to set the addresses manually and not the ports, take a look at <literal>listenAddresses</literal>.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
listenAddresses = mkOption {
|
||||||
|
type = with types; nonEmptyListOf str;
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Listen addresses for this virtual host.
|
||||||
|
Compared to <literal>listen</literal> this only sets the addreses
|
||||||
|
and the ports are chosen automatically.
|
||||||
|
'';
|
||||||
|
default = [ "*" ];
|
||||||
|
example = [ "127.0.0.1" ];
|
||||||
|
};
|
||||||
|
|
||||||
enableSSL = mkOption {
|
enableSSL = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
visible = false;
|
visible = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user