fix nulls

This commit is contained in:
soraefir
2026-05-08 20:59:40 +02:00
parent e2b688c836
commit d898116ff4
4 changed files with 10 additions and 10 deletions

View File

@@ -1,23 +1,23 @@
{ config, lib, serverCfg }:
let
builder =
{ image, secret ? ""
, subdomain ? "", ip ? "", port ? 0
{ image, secret ? null
, subdomain ? null, ip ? null, port ? 0
, extraEnv ? { }, extraLabels ? { }, extraOptions ? [ ]
, overrides ? { }
}:
let base = {
inherit image;
environmentFiles = if secret !="" then [ config.sops.secrets."${lib.toUpper secret}".path ] else [];
environmentFiles = if secret then [ config.sops.secrets."${lib.toUpper secret}".path ] else [];
environment = {} // extraEnv;
labels = if subdomain!="" then ({
labels = if subdomain then ({
"traefik.enable" = "true";
"traefik.http.routers.${subdomain}.entrypoints" = "web-secure";
"traefik.http.routers.${subdomain}.rule" = "Host(`${subdomain}.${serverCfg.hostDomain}`)";
"traefik.http.routers.${subdomain}.tls" = "true";
} // lib.optionalAttrs (port != 0) {
} // lib.optionalAttrs (port) {
"traefik.http.services.${subdomain}.loadbalancer.server.port" = toString port;
}) else {
"traefik.enable" = "false";
@@ -25,7 +25,7 @@ let
extraOptions = extraOptions ++ [
"--add-host=host.containers.internal:host-gateway"
] ++ lib.optional (ip != "") "--ip=${ip}";
] ++ lib.optional (ip) "--ip=${ip}";
};
in lib.recursiveUpdate base overrides;
in {

View File

@@ -37,7 +37,7 @@ in {
};
overrides = {
cmd = [ "server" ];
ports = if containerCfg.pubPort != 0 && containerCfg.port != 0 then [ "${toString containerCfg.pubPort}:${toString containerCfg.port}" ] else [];
ports = if containerCfg.pubPort && containerCfg.port then [ "${toString containerCfg.pubPort}:${toString containerCfg.port}" ] else [];
volumes = [
"${serverCfg.configPath}/authentik/media:/media"
"${serverCfg.configPath}/authentik/templates:/templates"

View File

@@ -47,7 +47,7 @@ in {
"--tmpfs /tmp:rw,mode=1777"
];
overrides = {
ports = if containerCfg.pubPort != 0 && containerCfg.port != 0 then [ "${toString containerCfg.pubPort}:${toString containerCfg.port}" ] else [];
ports = if containerCfg.pubPort && containerCfg.port then [ "${toString containerCfg.pubPort}:${toString containerCfg.port}" ] else [];
volumes = [
"${serverCfg.dataPath}/nextcloud/www:/var/www/html"
"${serverCfg.dataPath}/nextcloud/data:/var/www/html/data"