diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-05-20 16:58:16 +0200 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2026-05-20 16:58:16 +0200 |
| commit | bed1771ab1f65b55e396d6cfee49f574bec48421 (patch) | |
| tree | 2678b7d630028563546862ed59985ad9e85bf138 /modules/test_endpoint.nix | |
| parent | f4a4de6e867e1e1b44392d4a2c0711b34a9d3564 (diff) | |
Add test endpoint
Diffstat (limited to '')
| -rw-r--r-- | modules/test_endpoint.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/test_endpoint.nix b/modules/test_endpoint.nix new file mode 100644 index 0000000..701bce8 --- /dev/null +++ b/modules/test_endpoint.nix @@ -0,0 +1,44 @@ +{ lib, config, ... }: +let + cfg = config.wilkuu.services.test_endpoint; +in +{ + options.wilkuu.services.test_endpoint = with lib; { + enable = mkOption { + type = types.bool; + default = config.services.nginx.enable; + description = "Whenever to ssl-terminate a small test-endpoint"; + example = true; + }; + port = mkOption { + type = types.port; + default = 6767; + description = "The port to forward traffic to"; + example = 6969; + }; + domain = mkOption { + type = types.str; + default = "test.${config.networking.hostName}.wilkuu.xyz"; + description = "The domain to show"; + example = "test.example.com"; + }; + doACME = mkOption { + type = types.bool; + default = !config.addons.virtualisation.isTestVM; + description = "Whenever to enable SSL or not."; + example = false; + }; + }; + config = lib.mkIf cfg.enable { + services.nginx.virtualHosts.${cfg.domain} = { + addSSL = cfg.doACME; + enableACME = cfg.doACME; + locations."/" = { + proxyPass = "http://localhost:${toString cfg.port}"; + proxyWebsockets = true; + recommendedProxySettings = true; + }; + }; + + }; +} |
