feat(wordpress/module): Factorize ip construction
This commit is contained in:
parent
bdc23df66c
commit
9c457666f5
1 changed files with 6 additions and 6 deletions
|
@ -9,6 +9,7 @@ let
|
||||||
cfg = config.services.wp-containers;
|
cfg = config.services.wp-containers;
|
||||||
|
|
||||||
mkName = builtins.replaceStrings [ "." ] [ "-" ];
|
mkName = builtins.replaceStrings [ "." ] [ "-" ];
|
||||||
|
mkIp = ip: i: "${ip}.${builtins.toString i}";
|
||||||
|
|
||||||
mkConfig = { name, value, i }: {
|
mkConfig = { name, value, i }: {
|
||||||
services.wordpress = {
|
services.wordpress = {
|
||||||
|
@ -25,7 +26,7 @@ let
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = mkName name;
|
hostName = mkName name;
|
||||||
hosts."10.0.0.${builtins.toString i}" = [ name ];
|
hosts.${mkIp "10.0.0" i} = [ name ];
|
||||||
|
|
||||||
firewall.allowedTCPPorts = [ 443 ];
|
firewall.allowedTCPPorts = [ 443 ];
|
||||||
};
|
};
|
||||||
|
@ -51,8 +52,8 @@ let
|
||||||
mountPoint = certs.${site.name}.directory;
|
mountPoint = certs.${site.name}.directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
hostAddress = "10.31.41.${builtins.toString i}";
|
hostAddress = mkIp "10.31.41" i;
|
||||||
localAddress = "10.0.0.${builtins.toString i}";
|
localAddress = mkIp "10.0.0" i;
|
||||||
|
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
|
||||||
|
@ -66,9 +67,8 @@ let
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
|
||||||
locations."/".proxyPass = "https://10.31.41.${builtins.toString i}:${
|
locations."/".proxyPass =
|
||||||
builtins.toString (cfg.basePort + i)
|
"https://${mkIp "10.31.41" i}:${builtins.toString (cfg.basePort + i)}";
|
||||||
}";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue