forked from DGNum/infrastructure
feat(wordpress/module): Factorize ip construction more
This commit is contained in:
parent
9c457666f5
commit
3533076bd4
1 changed files with 6 additions and 4 deletions
|
@ -10,6 +10,8 @@ let
|
||||||
|
|
||||||
mkName = builtins.replaceStrings [ "." ] [ "-" ];
|
mkName = builtins.replaceStrings [ "." ] [ "-" ];
|
||||||
mkIp = ip: i: "${ip}.${builtins.toString i}";
|
mkIp = ip: i: "${ip}.${builtins.toString i}";
|
||||||
|
mkHost = mkIp "10.31.41";
|
||||||
|
mkLocal = mkIp "10.0.0";
|
||||||
|
|
||||||
mkConfig = { name, value, i }: {
|
mkConfig = { name, value, i }: {
|
||||||
services.wordpress = {
|
services.wordpress = {
|
||||||
|
@ -26,7 +28,7 @@ let
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = mkName name;
|
hostName = mkName name;
|
||||||
hosts.${mkIp "10.0.0" i} = [ name ];
|
hosts.${mkLocal i} = [ name ];
|
||||||
|
|
||||||
firewall.allowedTCPPorts = [ 443 ];
|
firewall.allowedTCPPorts = [ 443 ];
|
||||||
};
|
};
|
||||||
|
@ -52,8 +54,8 @@ let
|
||||||
mountPoint = certs.${site.name}.directory;
|
mountPoint = certs.${site.name}.directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
hostAddress = mkIp "10.31.41" i;
|
hostAddress = mkHost i;
|
||||||
localAddress = mkIp "10.0.0" i;
|
localAddress = mkLocal i;
|
||||||
|
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ let
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
|
||||||
locations."/".proxyPass =
|
locations."/".proxyPass =
|
||||||
"https://${mkIp "10.31.41" i}:${builtins.toString (cfg.basePort + i)}";
|
"https://${mkHost i}:${builtins.toString (cfg.basePort + i)}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue