mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor: move kanidm to tei
This commit is contained in:
parent
b9e1f544f7
commit
b892e420ab
7 changed files with 80 additions and 28 deletions
|
|
@ -4,19 +4,41 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.modules) mkDefault;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault mkOptionDefault;
|
||||
cfg = config.services.zigbee2mqtt;
|
||||
access = config.services.nginx.access.zigbee2mqtt;
|
||||
in {
|
||||
services.nginx.virtualHosts.${cfg.domain} = {
|
||||
vouch.enable = true;
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = mkDefault "http://127.0.0.1:${toString cfg.settings.frontend.port}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_http_version 1.1;
|
||||
'';
|
||||
options.services.nginx.access.zigbee2mqtt = with lib.types; {
|
||||
host = mkOption {
|
||||
type = str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = str;
|
||||
};
|
||||
port = mkOption {
|
||||
type = port;
|
||||
};
|
||||
};
|
||||
config.services.nginx = {
|
||||
access.zigbee2mqtt = mkIf cfg.enable {
|
||||
domain = mkOptionDefault cfg.domain;
|
||||
host = mkOptionDefault "localhost";
|
||||
port = mkIf (cfg.settings ? frontend.port) (
|
||||
mkOptionDefault cfg.settings.frontend.port
|
||||
);
|
||||
};
|
||||
virtualHosts.${access.domain} = {
|
||||
vouch.enable = true;
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = mkDefault "http://${access.host}:${toString access.port}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_http_version 1.1;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue