mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
fix(nginx): proxied listen
This commit is contained in:
parent
f2c7178486
commit
f9b02a03a4
18 changed files with 185 additions and 90 deletions
|
|
@ -11,12 +11,22 @@ in {
|
|||
assertion = config.ports.http.port == cfg.defaultHTTPListenPort && config.ports.https.port == cfg.defaultSSLListenPort;
|
||||
message = "ports mismatch";
|
||||
};
|
||||
assertProxied = nixosConfig: cfg: {
|
||||
assertion = config.ports.proxied.enable == cfg.proxied.enabled;
|
||||
message = "proxied mismatch";
|
||||
};
|
||||
assertProxiedPort = nixosConfig: cfg: {
|
||||
assertion = !config.ports.proxied.enable || config.ports.proxied.port == cfg.proxied.listenPort;
|
||||
message = "proxied.port mismatch";
|
||||
};
|
||||
in {
|
||||
nixos = {
|
||||
serviceAttr = "nginx";
|
||||
assertions = mkIf config.enable [
|
||||
(mkAssertion assertPorts)
|
||||
];
|
||||
assertions = mkIf config.enable (map mkAssertion [
|
||||
assertPorts
|
||||
assertProxied
|
||||
assertProxiedPort
|
||||
]);
|
||||
};
|
||||
defaults.port.listen = mkAlmostOptionDefault "lan";
|
||||
ports = mapAttrs (_: mapAlmostOptionDefaults) {
|
||||
|
|
@ -29,6 +39,12 @@ in {
|
|||
port = 443;
|
||||
protocol = "https";
|
||||
};
|
||||
proxied = {
|
||||
enable = false;
|
||||
port = 9080;
|
||||
protocol = "http";
|
||||
listen = "lan";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue