From aacde4a3f54d0e4dab2eb52da280d52183b08178 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 8 Mar 2021 00:05:14 +0100 Subject: new option: backend proxy is now optional --- default.nix | 13 ++++++++----- example.nix | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index d739a4c..18f32e6 100644 --- a/default.nix +++ b/default.nix @@ -66,13 +66,16 @@ with lib; root = # need to do it this (long) way since a user may change this value outside of this module let ssl = config.services.nginx.virtualHosts.${cfg.frontend.domain}.enableSSL; - in (cfg.frontend.package.override { + in (cfg.frontend.package.override ({ baseurl = (if ssl then "https://" else "http://") + cfg.frontend.domain; + } // (if cfg.frontend.proxyBackend then { serverurl = (if ssl then "wss" else "ws") + "://${cfg.frontend.domain}/websocket"; - }).outPath; - locations."/websocket" = { - proxyPass = "http://localhost:9160"; - proxyWebsockets = true; + } else {} ))).outPath; + locations = mkIf cfg.frontend.proxyBackend { + "/websocket" = { + proxyPass = "http://localhost:9160"; + proxyWebsockets = true; + }; }; }; }; diff --git a/example.nix b/example.nix index 4c66bc9..8eb7582 100644 --- a/example.nix +++ b/example.nix @@ -8,6 +8,7 @@ frontend = { enable = true; domain = "10.233.4.2"; + proxyBackend = true; }; }; -- cgit v1.2.3