Changed caddy config

This commit is contained in:
2025-06-03 19:24:29 +02:00
parent 9fd98e97fe
commit 5da7636a42
19 changed files with 97 additions and 54 deletions

View File

@@ -5,6 +5,12 @@ with lib;
let
cfg = config.settings.containers.caddy;
toInternal = name: routesDef: {
name = name;
host = routesDef.host;
url = routesDef.url;
};
generateRoutes = domain: entries: lib.concatMapStrings (route: ''
@${route.name} host ${route.host}.${domain}
handle @${route.name} {
@@ -13,11 +19,8 @@ let
'') entries;
routesOption = lib.mkOption {
type = types.listOf (types.submodule {
type = types.attrsOf (types.submodule {
options = {
name = mkOption {
type = types.str;
};
url = mkOption {
type = types.str;
};
@@ -79,7 +82,7 @@ in {
resolvers 1.1.1.1
}
${generateRoutes cfg.routes.tbmrs.domain cfg.routes.tbmrs.routes}
${generateRoutes cfg.routes.tbmrs.domain (mapAttrsToList toInternal cfg.routes.tbmrs.routes)}
}
*.local.tbmrs.nl {
@@ -88,7 +91,7 @@ in {
resolvers 1.1.1.1
}
${generateRoutes cfg.routes.tbmrs-local.domain cfg.routes.tbmrs-local.routes}
${generateRoutes cfg.routes.tbmrs-local.domain (mapAttrsToList toInternal cfg.routes.tbmrs-local.routes)}
}
'';
};