diff options
Diffstat (limited to '')
-rw-r--r-- | default.nix | 13 | ||||
-rw-r--r-- | 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; }; }; |