From 33e003d4b435672cc7425f35e6405a0815117194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Thu, 16 Nov 2023 20:10:39 +0100 Subject: [PATCH] feat: add wellknown for matrix test domain --- hosts/nachtigall/apps/nginx-matrix.nix | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hosts/nachtigall/apps/nginx-matrix.nix b/hosts/nachtigall/apps/nginx-matrix.nix index da6edeee..eaee4155 100644 --- a/hosts/nachtigall/apps/nginx-matrix.nix +++ b/hosts/nachtigall/apps/nginx-matrix.nix @@ -6,10 +6,10 @@ let add_header X-XSS-Protection "1; mode=block"; ''; clientConfig = import ./matrix/element-client-config.nix; - wellKnownClient = { - "m.homeserver".base_url = "https://matrix.pub.solar"; - "m.identity_server".base_url = "https://matrix.pub.solar"; - "org.matrix.msc3575.proxy".url = "https://matrix.pub.solar/sliding-sync"; + wellKnownClient = domain: { + "m.homeserver".base_url = "https://matrix.${domain}"; + "m.identity_server".base_url = "https://matrix.${domain}"; + "org.matrix.msc3575.proxy".url = "https://matrix.${domain}/sliding-sync"; "im.vector.riot.e2ee".default = true; "io.element.e2ee" = { default = true; @@ -19,21 +19,21 @@ let "m.integrations" = { managers = [ { - api_url = "https://dimension.pub.solar/api/v1/scalar"; - ui_url = "https://dimension.pub.solar/element"; + api_url = "https://dimension.${domain}/api/v1/scalar"; + ui_url = "https://dimension.${domain}/element"; } ]; }; }; - wellKnownServer."m.server" = "matrix.pub.solar:8448"; + wellKnownServer = domain: { "m.server" = "${domain}:8448"; }; mkWellKnown = data: '' add_header Content-Type application/json; add_header Access-Control-Allow-Origin *; return 200 '${builtins.toJSON data}'; ''; - wellKnownLocations = { - "= /.well-known/matrix/server".extraConfig = mkWellKnown wellKnownServer; - "= /.well-known/matrix/client".extraConfig = mkWellKnown wellKnownClient; + wellKnownLocations = domain: { + "= /.well-known/matrix/server".extraConfig = mkWellKnown (wellKnownServer domain); + "= /.well-known/matrix/client".extraConfig = mkWellKnown (wellKnownClient domain); }; in { @@ -44,7 +44,7 @@ in ##################################### "pub.solar" = { - locations = wellKnownLocations; + locations = wellKnownLocations "pub.solar"; }; ####################################### @@ -70,7 +70,7 @@ in gzip on; gzip_types text/plain application/json; ''; - locations = wellKnownLocations // { + locations = (wellKnownLocations "test.pub.solar") // { # TODO: Configure metrics # "/metrics" = { # };