forked from DGNum/infrastructure
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;
|
||||
|
||||
mkName = builtins.replaceStrings [ "." ] [ "-" ];
|
||||
mkIp = ip: i: "${ip}.${builtins.toString i}";
|
||||
|
||||
mkConfig = { name, value, i }: {
|
||||
services.wordpress = {
|
||||
|
@ -25,7 +26,7 @@ let
|
|||
|
||||
networking = {
|
||||
hostName = mkName name;
|
||||
hosts."10.0.0.${builtins.toString i}" = [ name ];
|
||||
hosts.${mkIp "10.0.0" i} = [ name ];
|
||||
|
||||
firewall.allowedTCPPorts = [ 443 ];
|
||||
};
|
||||
|
@ -51,8 +52,8 @@ let
|
|||
mountPoint = certs.${site.name}.directory;
|
||||
};
|
||||
|
||||
hostAddress = "10.31.41.${builtins.toString i}";
|
||||
localAddress = "10.0.0.${builtins.toString i}";
|
||||
hostAddress = mkIp "10.31.41" i;
|
||||
localAddress = mkIp "10.0.0" i;
|
||||
|
||||
autoStart = true;
|
||||
|
||||
|
@ -66,9 +67,8 @@ let
|
|||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."/".proxyPass = "https://10.31.41.${builtins.toString i}:${
|
||||
builtins.toString (cfg.basePort + i)
|
||||
}";
|
||||
locations."/".proxyPass =
|
||||
"https://${mkIp "10.31.41" i}:${builtins.toString (cfg.basePort + i)}";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue