forked from danio/nixos-matrix-modules
synapse: add smarter defaults for database configuration
This commit is contained in:
@@ -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 = ''
|
||||
|
||||
Reference in New Issue
Block a user