synapse: add smarter defaults for database configuration

This commit is contained in:
2026-06-22 15:21:37 +09:00
parent 56a3a5985f
commit 84f7e38e3b
+51
View File
@@ -286,6 +286,57 @@ in
];
};
database.name = mkOption {
type = types.enum [
"sqlite3"
"psycopg2"
];
default = "psycopg2";
description = ''
The database engine name. Can be sqlite3 or psycopg2.
'';
};
database.args.database = mkOption {
type = types.str;
default =
{
sqlite3 = "${cfg.dataDir}/homeserver.db";
psycopg2 = "matrix-synapse";
}
.${cfg.settings.database.name};
defaultText = literalExpression ''
{
sqlite3 = "''${${cfgText}.dataDir}/homeserver.db";
psycopg2 = "matrix-synapse";
}.''${${cfgText}.settings.database.name};
'';
description = ''
Name of the database when using the psycopg2 backend,
path to the database location when using sqlite3.
'';
};
database.args.user = mkOption {
type = types.nullOr types.str;
default =
{
sqlite3 = null;
psycopg2 = "matrix-synapse";
}
.${cfg.settings.database.name};
defaultText = lib.literalExpression ''
{
sqlite3 = null;
psycopg2 = "matrix-synapse";
}.''${${cfgText}.settings.database.name};
'';
description = ''
Username to connect with psycopg2, set to null
when using sqlite3.
'';
};
federation_ip_range_blacklist = mkOption {
type = types.listOf types.str;
description = ''