refactor(reverse-proxy): use route registry
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
config,
|
||||
lib,
|
||||
my,
|
||||
reverseProxyFleetRoutes ? config.modules.reverse-proxy.routes,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -18,12 +17,13 @@ let
|
||||
"todo.alexion.dev"
|
||||
"wings.alexion.dev"
|
||||
];
|
||||
legacyRoutes = lib.listToAttrs (
|
||||
legacyVirtualHosts = lib.listToAttrs (
|
||||
map (host: {
|
||||
name = "legacy-${lib.replaceStrings [ "." ] [ "-" ] host}";
|
||||
name = host;
|
||||
value = {
|
||||
inherit host;
|
||||
backend = legacyBackend;
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = legacyBackend;
|
||||
};
|
||||
}) legacyHosts
|
||||
);
|
||||
@@ -33,10 +33,9 @@ in
|
||||
(my.guest {
|
||||
name = "reverse-proxy";
|
||||
interior = {
|
||||
modules.reverse-proxy = {
|
||||
enable = true;
|
||||
routes = reverseProxyFleetRoutes // legacyRoutes;
|
||||
};
|
||||
modules.reverse-proxy.enable = true;
|
||||
|
||||
services.nginx.virtualHosts = legacyVirtualHosts;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 2022 ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user