Add support to externeal subdomain
This commit is contained in:
parent
e754d926eb
commit
c3c23d3494
2 changed files with 46 additions and 0 deletions
|
|
@ -133,6 +133,15 @@ in
|
||||||
cloudflareApiEnvName = "CLOUDFLARE_API_TOKEN";
|
cloudflareApiEnvName = "CLOUDFLARE_API_TOKEN";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraVirtualHosts = [
|
||||||
|
{
|
||||||
|
subdomain = "h";
|
||||||
|
host = "http://ha.internal:8123";
|
||||||
|
domain = publicDomain;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ddclient = {
|
ddclient = {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,32 @@ in
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# List of extra caddy.virtualHost
|
||||||
|
extraVirtualHosts = lib.mkOption {
|
||||||
|
type = lib.types.listOf (
|
||||||
|
lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
subdomain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "The subdomain for the virtual host.";
|
||||||
|
};
|
||||||
|
host = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "The host address for the reverse proxy.";
|
||||||
|
};
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "The domain for the virtual host.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
description = ''
|
||||||
|
A list of virtual hosts outside nixos/colmena config.
|
||||||
|
'';
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
@ -134,6 +160,17 @@ in
|
||||||
) cfg.domainsList
|
) cfg.domainsList
|
||||||
);
|
);
|
||||||
|
|
||||||
|
virtualHosts = lib.foldl' (
|
||||||
|
acc: extraVirtualHost:
|
||||||
|
acc
|
||||||
|
// {
|
||||||
|
"${extraVirtualHost.subdomain}.${extraVirtualHost.domain}".extraConfig = ''
|
||||||
|
reverse_proxy ${extraVirtualHost.host}
|
||||||
|
import cloudflare_${extraVirtualHost.domain}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
) { } cfg.extraVirtualHosts;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.caddy.serviceConfig = {
|
systemd.services.caddy.serviceConfig = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue