fix(nginx): Propagate dnsProvider to www hosts
When we auto-created www hosts, we made an oversight by not also
propagating dnsProvider. This caused an error when using www, which we
missed because our tests also didn't check for propagation of
dnsProvider
In the meantime, we need to update our unit tests for these functions,
as by missing out dnsProvider we have effectively nailed down its
nonexistence
Finally, we also add a regression test (auxolotl-eval.check.nix), based
on the real-life example that made this fail - provided by Auxolotl's
Jake Hamilton (thanks!). That file is licensed as Auxolotl's infra is
Change-Id: I8a08a29033b9d47ca43ce87f24fe17823a6da440
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/817
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/lib/nginx/http/internal/default.nix b/lib/nginx/http/internal/default.nix
index 767bc6f..d5b679e 100644
--- a/lib/nginx/http/internal/default.nix
+++ b/lib/nginx/http/internal/default.nix
@@ -9,6 +9,7 @@
then {
"${name}" = lib.attrsets.removeAttrs host [ "www" ];
"www.${name}" = {
+ inherit (host) dnsProvider;
routes."~ ^/?([^\r\n]*)$" = lib.home-manager.hm.dag.entryAnywhere (lib.clicks.nginx.http.redirectPermanent "https://${name}/$1");
service = null;
enableHttp = host.enableHttp;
diff --git a/lib/nginx/http/internal/lib.nginx.http.internal.design.spec.nix b/lib/nginx/http/internal/lib.nginx.http.internal.design.spec.nix
index 6710523..4d81e3a 100644
--- a/lib/nginx/http/internal/lib.nginx.http.internal.design.spec.nix
+++ b/lib/nginx/http/internal/lib.nginx.http.internal.design.spec.nix
@@ -34,6 +34,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
service = null;
enableHttp = false;
@@ -59,6 +60,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -93,6 +95,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -127,6 +130,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -156,6 +160,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -177,6 +182,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -200,6 +206,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
onlySSL = true;
addSSL = false;
useACMEHost = "www.calibre.clicks.codes";
diff --git a/lib/nginx/http/internal/lib.nginx.http.internal.header.spec.nix b/lib/nginx/http/internal/lib.nginx.http.internal.header.spec.nix
index 97756f4..88a438f 100644
--- a/lib/nginx/http/internal/lib.nginx.http.internal.header.spec.nix
+++ b/lib/nginx/http/internal/lib.nginx.http.internal.header.spec.nix
@@ -39,6 +39,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
service = null;
enableHttp = false;
@@ -69,6 +70,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -108,6 +110,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -144,6 +147,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -174,6 +178,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -196,6 +201,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -220,6 +226,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
onlySSL = true;
addSSL = false;
useACMEHost = "www.calibre.clicks.codes";
diff --git a/lib/nginx/http/internal/lib.nginx.http.internal.headers.spec.nix b/lib/nginx/http/internal/lib.nginx.http.internal.headers.spec.nix
index 66ced1d..004e439 100644
--- a/lib/nginx/http/internal/lib.nginx.http.internal.headers.spec.nix
+++ b/lib/nginx/http/internal/lib.nginx.http.internal.headers.spec.nix
@@ -47,6 +47,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
service = null;
enableHttp = false;
@@ -82,6 +83,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -126,6 +128,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -163,6 +166,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -193,6 +197,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -215,6 +220,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -239,6 +245,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
onlySSL = true;
addSSL = false;
useACMEHost = "www.calibre.clicks.codes";
diff --git a/lib/nginx/http/internal/lib.nginx.http.internal.http.spec.nix b/lib/nginx/http/internal/lib.nginx.http.internal.http.spec.nix
index 4f56d96..2b0e6f1 100644
--- a/lib/nginx/http/internal/lib.nginx.http.internal.http.spec.nix
+++ b/lib/nginx/http/internal/lib.nginx.http.internal.http.spec.nix
@@ -34,6 +34,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
service = null;
enableHttp = true;
@@ -59,6 +60,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = true;
};
@@ -93,6 +95,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = true;
};
@@ -127,6 +130,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = true;
};
@@ -156,6 +160,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = true;
};
@@ -177,6 +182,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = true;
};
@@ -200,6 +206,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
onlySSL = false;
addSSL = true;
useACMEHost = "www.calibre.clicks.codes";
diff --git a/lib/nginx/http/internal/lib.nginx.http.internal.https-proxy.spec.nix b/lib/nginx/http/internal/lib.nginx.http.internal.https-proxy.spec.nix
index 77ad490..801230c 100644
--- a/lib/nginx/http/internal/lib.nginx.http.internal.https-proxy.spec.nix
+++ b/lib/nginx/http/internal/lib.nginx.http.internal.https-proxy.spec.nix
@@ -34,6 +34,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
service = null;
enableHttp = false;
@@ -59,6 +60,7 @@
_type = "redirect";
headers = null;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -93,6 +95,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -127,6 +130,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -156,6 +160,7 @@
};
}
];
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -177,6 +182,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
authWith = null;
enableHttp = false;
};
@@ -200,6 +206,7 @@
return = "307 https://calibre.clicks.codes/$1";
priority = 100;
};
+ dnsProvider = "cloudflare";
onlySSL = true;
addSSL = false;
useACMEHost = "www.calibre.clicks.codes";