Merge pull request 'feat: add back matrix test domain' (#63) from feat/add-back-matrix-test-domain into main

Reviewed-on: pub-solar/infra#63
Reviewed-by: b12f <b12f@noreply.git.pub.solar>
This commit is contained in:
b12f 2023-11-18 21:33:40 +00:00
commit aa23765ff3
Signed by: pub.solar gitea
GPG key ID: F0332B04B7054873
2 changed files with 20 additions and 13 deletions

View file

@ -63,7 +63,6 @@
agenix agenix
cachix cachix
editorconfig-checker editorconfig-checker
nix
nodePackages.prettier nodePackages.prettier
nvfetcher nvfetcher
shellcheck shellcheck

View file

@ -6,10 +6,10 @@ let
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
''; '';
clientConfig = import ./matrix/element-client-config.nix; clientConfig = import ./matrix/element-client-config.nix;
wellKnownClient = { wellKnownClient = domain: {
"m.homeserver".base_url = "https://matrix.pub.solar"; "m.homeserver".base_url = "https://matrix.${domain}";
"m.identity_server".base_url = "https://matrix.pub.solar"; "m.identity_server".base_url = "https://matrix.${domain}";
"org.matrix.msc3575.proxy".url = "https://matrix.pub.solar/sliding-sync"; "org.matrix.msc3575.proxy".url = "https://matrix.${domain}/sliding-sync";
"im.vector.riot.e2ee".default = true; "im.vector.riot.e2ee".default = true;
"io.element.e2ee" = { "io.element.e2ee" = {
default = true; default = true;
@ -19,21 +19,21 @@ let
"m.integrations" = { "m.integrations" = {
managers = [ managers = [
{ {
api_url = "https://dimension.pub.solar/api/v1/scalar"; api_url = "https://dimension.${domain}/api/v1/scalar";
ui_url = "https://dimension.pub.solar/element"; ui_url = "https://dimension.${domain}/element";
} }
]; ];
}; };
}; };
wellKnownServer."m.server" = "matrix.pub.solar:8448"; wellKnownServer = domain: { "m.server" = "matrix.${domain}:8448"; };
mkWellKnown = data: '' mkWellKnown = data: ''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON data}'; return 200 '${builtins.toJSON data}';
''; '';
wellKnownLocations = { wellKnownLocations = domain: {
"= /.well-known/matrix/server".extraConfig = mkWellKnown wellKnownServer; "= /.well-known/matrix/server".extraConfig = mkWellKnown (wellKnownServer domain);
"= /.well-known/matrix/client".extraConfig = mkWellKnown wellKnownClient; "= /.well-known/matrix/client".extraConfig = mkWellKnown (wellKnownClient domain);
}; };
in in
{ {
@ -44,12 +44,20 @@ in
##################################### #####################################
"pub.solar" = { "pub.solar" = {
locations = wellKnownLocations; locations = wellKnownLocations "pub.solar";
}; };
####################################### #######################################
# Stuff below is still in betatesting # # Stuff below is still in betatesting #
####################################### #######################################
"test.pub.solar" = {
root = "/dev/null";
forceSSL = lib.mkDefault true;
enableACME = lib.mkDefault true;
locations = (wellKnownLocations "test.pub.solar");
};
"chat.test.pub.solar" = { "chat.test.pub.solar" = {
forceSSL = true; forceSSL = true;
@ -70,7 +78,7 @@ in
gzip on; gzip on;
gzip_types text/plain application/json; gzip_types text/plain application/json;
''; '';
locations = wellKnownLocations // { locations = {
# TODO: Configure metrics # TODO: Configure metrics
# "/metrics" = { # "/metrics" = {
# }; # };