From 3533076bd47b984c38b8185dc28ca87c1b10ca96 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 8 Jan 2024 18:01:32 +0100 Subject: [PATCH] feat(wordpress/module): Factorize ip construction more --- machines/web01/wordpress/module.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/machines/web01/wordpress/module.nix b/machines/web01/wordpress/module.nix index 8e227f0..7c6fc02 100644 --- a/machines/web01/wordpress/module.nix +++ b/machines/web01/wordpress/module.nix @@ -10,6 +10,8 @@ let mkName = builtins.replaceStrings [ "." ] [ "-" ]; mkIp = ip: i: "${ip}.${builtins.toString i}"; + mkHost = mkIp "10.31.41"; + mkLocal = mkIp "10.0.0"; mkConfig = { name, value, i }: { services.wordpress = { @@ -26,7 +28,7 @@ let networking = { hostName = mkName name; - hosts.${mkIp "10.0.0" i} = [ name ]; + hosts.${mkLocal i} = [ name ]; firewall.allowedTCPPorts = [ 443 ]; }; @@ -52,8 +54,8 @@ let mountPoint = certs.${site.name}.directory; }; - hostAddress = mkIp "10.31.41" i; - localAddress = mkIp "10.0.0" i; + hostAddress = mkHost i; + localAddress = mkLocal i; autoStart = true; @@ -68,7 +70,7 @@ let forceSSL = true; locations."/".proxyPass = - "https://${mkIp "10.31.41" i}:${builtins.toString (cfg.basePort + i)}"; + "https://${mkHost i}:${builtins.toString (cfg.basePort + i)}"; }; };