diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/network/service-router.service.nix (renamed from modules/service-router.service.nix) | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/service-router.service.nix b/modules/network/service-router.service.nix index 0b9a873..9c4e6e2 100644 --- a/modules/service-router.service.nix +++ b/modules/network/service-router.service.nix @@ -19,6 +19,7 @@ in { port = mkOption { type = types.int; }; host = mkOption { type = types.str; default = "127.0.0.1"; }; protocol = mkOption { type = types.str; default = "http"; }; + nginx = mkOption { type = types.attrs; default = {}; }; }; }); default = {}; }; @@ -27,10 +28,12 @@ in { config = lib.mkIf cfg.enable { services.nginx = { enable = true; + recommendedOptimisation = true; virtualHosts = lib.mapAttrs (_: val: { - locations."/" = { + locations."/" = if val.nginx == {} then { proxyPass = "${val.protocol}://${val.host}:${toString val.port}"; - }; + proxyWebsockets = true; + } else val.nginx; }) cfg.routes; }; |
