infrastructure/machines/web01/redirections.nix
Tom Hubrecht 054f98fc34
All checks were successful
lint / check (push) Successful in 24s
build configuration / build_vault01 (push) Successful in 1m1s
build configuration / build_web02 (push) Successful in 59s
build configuration / build_compute01 (push) Successful in 1m7s
build configuration / build_storage01 (push) Successful in 1m16s
build configuration / build_web01 (push) Successful in 1m26s
npins update / npins_update (push) Successful in 1m24s
ds-fr update / npins_update (push) Successful in 1m58s
feat(redirections): Add more precise redirection for retired websites, to make analytics relevant
2024-02-14 11:15:46 +01:00

72 lines
1.5 KiB
Nix

_:
let
retired_host = "retired.dgnum.eu";
mkRetired =
hosts:
builtins.listToAttrs (
builtins.map
(name: {
inherit name;
value = {
enableACME = true;
forceSSL = true;
locations."/".return = "301 https://${retired_host}/${name}";
};
})
hosts
);
mkSub = domain: builtins.map (s: "${s}.${domain}");
mkSubs = attrs: builtins.concatLists (builtins.attrValues (builtins.mapAttrs mkSub attrs));
mkRedirection =
_:
{ to }:
{
globalRedirect = to;
enableACME = true;
forceSSL = true;
};
redirections = {
"calendrier.eleves.ens.fr".to = "calendrier.dgnum.eu";
"docs.beta.rz.ens.wtf".to = "pads.dgnum.eu";
"git.rz.ens.wtf".to = "git.dgnum.eu";
"notion.rz.ens.wtf".to = "docs.dgnum.eu";
"nuage.beta.rz.ens.wtf".to = "cloud.dgnum.eu";
"rdv.dgnum.eu".to = "meet.dgnum.eu";
"www.bda.ens.fr".to = "bda.ens.fr";
"bda.wp.dgnum.eu".to = "bda.ens.fr";
};
retired = mkSubs {
"ens.fr" = [
"alevins"
"www.climatenavigator"
];
"ens.wtf" = [ "photos" ];
"rz.ens.wtf" = [
"s3"
"cdn"
];
"beta.rz.ens.wtf" = [
"todo"
"minecraft"
"factorio"
"home"
"pads"
"api.pads"
"files.pads"
"sandbox.pads"
"jurisprudens"
"rstudio"
];
};
in
{
services.nginx.virtualHosts = {
${retired_host}.default = true;
} // (builtins.mapAttrs mkRedirection redirections) // (mkRetired retired);
}