Refactor
This commit is contained in:
parent
5dbdf38849
commit
8fb1ec8330
2 changed files with 37 additions and 20 deletions
|
@ -1,4 +1,8 @@
|
||||||
{...}: {
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
defaults.email = "personal+letsencrypt@peprolinbot.com";
|
defaults.email = "personal+letsencrypt@peprolinbot.com";
|
||||||
|
@ -15,29 +19,41 @@
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
|
|
||||||
virtualHosts = {
|
virtualHosts = let
|
||||||
"ha.campares.duckdns.org" = {
|
base = locations: {
|
||||||
|
inherit locations;
|
||||||
|
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
extraConfig = ''
|
|
||||||
proxy_buffering off;
|
|
||||||
'';
|
|
||||||
locations."/" = {
|
|
||||||
proxyPass = "http://[::1]:8123";
|
|
||||||
proxyWebsockets = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
"wg.campares.duckdns.org" = {
|
|
||||||
forceSSL = true;
|
proxy = {
|
||||||
enableACME = true;
|
port,
|
||||||
extraConfig = ''
|
websockets ? false,
|
||||||
proxy_buffering off;
|
}:
|
||||||
'';
|
(base {
|
||||||
locations."/" = {
|
"/" = {
|
||||||
proxyPass = "http://[::1]:8000";
|
proxyPass = "http://[::1]:" + toString port + "/";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = websockets;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
// {
|
||||||
|
extraConfig = lib.mkIf websockets ''
|
||||||
|
proxy_buffering off;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
proxySimple = port: proxy {inherit port;};
|
||||||
|
|
||||||
|
proxyWebsockets = port:
|
||||||
|
proxy {
|
||||||
|
inherit port;
|
||||||
|
websockets = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
"ha.campares.duckdns.org" = proxyWebsockets config.services.home-assistant.config.http.server_port;
|
||||||
|
|
||||||
|
"wg.campares.duckdns.org" = proxySimple config.services.wg-access-server.settings.port;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
httpHost = "::1";
|
httpHost = "::1";
|
||||||
|
port = 8000;
|
||||||
};
|
};
|
||||||
|
|
||||||
secretsFile = config.clan.core.vars.generators.wg-access-server.files.secrets-file.path;
|
secretsFile = config.clan.core.vars.generators.wg-access-server.files.secrets-file.path;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue