Serve /.well-known

This commit is contained in:
Natsu Kagami 2022-06-10 17:37:19 -04:00 committed by Natsu Kagami
parent c9007e1e59
commit a6b508b91f

View file

@ -22,6 +22,11 @@ with lib;
type = types.bool;
default = false;
};
well-known_port = mkOption {
type = types.int;
default = 6166;
};
};
config.services.matrix-conduit = mkIf cfg.enable {
@ -34,8 +39,25 @@ with lib;
};
};
config.cloud.traefik.hosts.conduit = mkIf cfg.enable {
inherit (cfg) port host;
# Serving .well-known files
config.services.nginx = mkIf cfg.enable {
enable = true;
virtualHosts.conduit-well-kwown = {
listen = [{ addr = "127.0.0.1"; port = cfg.well-known_port; }];
root = pkgs.writeTextDir ".well-known/matrix/server" ''
{
"m.server": "${cfg.host}:443"
}
'';
};
};
config.cloud.traefik.hosts = mkIf cfg.enable {
conduit = { inherit (cfg) port host; };
conduit-well-kwown = {
port = cfg.well-known_port;
filter = "Host(`${cfg.host}`) && PathPrefix(`/.well-known`)";
};
};
}