fix: better handling of domain

This commit is contained in:
silver 2023-05-21 12:08:26 +01:00
parent 6e58eac8c1
commit ad2c9dad6b

View file

@ -30,10 +30,17 @@ Gonna use a priper nixos module for this
}; };
}; };
subdomain = mkOption { domain = {
base = mkOption {
type = types.str;
default = "skynet.ie";
};
sub = mkOption {
type = types.str; type = types.str;
default = "sso"; default = "sso";
}; };
};
frontend.port = mkOption { frontend.port = mkOption {
type = types.port; type = types.port;
@ -65,7 +72,7 @@ Gonna use a priper nixos module for this
}; };
skynet_dns.records.cname = [ skynet_dns.records.cname = [
"${cfg.subdomain} CNAME ${cfg.host.name}" "${cfg.domain.sub} CNAME ${cfg.host.name}"
]; ];
# firewall on teh computer itself # firewall on teh computer itself
@ -154,7 +161,7 @@ Gonna use a priper nixos module for this
}; };
services.nginx.virtualHosts."${cfg.subdomain}.skynet.ie" = { services.nginx.virtualHosts."${cfg.domain.sub}.${cfg.domain.base}" = {
forceSSL = true; forceSSL = true;
useACMEHost = "skynet"; useACMEHost = "skynet";
locations."/".proxyPass = "http://localhost:${cfg.frontend.port}"; locations."/".proxyPass = "http://localhost:${cfg.frontend.port}";