aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2021-03-08 00:05:14 +0100
committerstuebinm2021-03-08 00:05:14 +0100
commitaacde4a3f54d0e4dab2eb52da280d52183b08178 (patch)
tree0eccd5312f8cfc38b81a20a9a19729da299bce3d
parent92c1ef1af95740077282d773242fdd1820c8d15b (diff)
new option: backend proxy is now optional
-rw-r--r--default.nix13
-rw-r--r--example.nix1
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;
};
};