Extend nix modules for new config options

This commit is contained in:
eikek 2022-03-21 14:58:15 +01:00
parent 5de6c8940d
commit f0b652d142
3 changed files with 143 additions and 0 deletions

View File

@ -4,6 +4,11 @@ let
full-text-search = {
enabled = true;
solr.url = "http://localhost:${toString config.services.solr.port}/solr/docspell";
postgresql = {
pg-config = {
"german" = "my-germam";
};
};
};
in
{

View File

@ -213,6 +213,7 @@ Docpell Update Check
};
full-text-search = {
enabled = false;
backend = "solr";
solr = {
url = "http://localhost:8983/solr/docspell";
commit-within = 1000;
@ -220,6 +221,17 @@ Docpell Update Check
def-type = "lucene";
q-op = "OR";
};
postgresql = {
use-default-connection = false;
jdbc = {
url = "jdbc:postgresql://server:5432/db";
user = "pguser";
password = "";
};
pg-config = {};
pg-query-parser = "websearch_to_tsquery";
pg-rank-normalization = [ 4 ];
};
migration = {
index-all-chunk = 10;
};
@ -1371,6 +1383,12 @@ in {
Currently the SOLR search platform is supported.
'';
};
backend = mkOption {
type = types.str;
default = defaults.full-text-search.backend;
description = "The backend to use, either solr or postgresql";
};
solr = mkOption {
type = types.submodule({
options = {
@ -1408,6 +1426,61 @@ in {
default = defaults.full-text-search.solr;
description = "Configuration for the SOLR backend.";
};
postgresql = mkOption {
type = types.submodule({
options = {
use-default-connection = mkOption {
type = types.bool;
default = defaults.full-text-search.postgresql.use-default-connection;
description = "Whether to use the primary db connection.";
};
jdbc = mkOption {
type = types.submodule ({
options = {
url = mkOption {
type = types.str;
default = defaults.jdbc.url;
description = ''
The URL to the database.
'';
};
user = mkOption {
type = types.str;
default = defaults.jdbc.user;
description = "The user name to connect to the database.";
};
password = mkOption {
type = types.str;
default = defaults.jdbc.password;
description = "The password to connect to the database.";
};
};
});
default = defaults.full-text-search.postgresql.jdbc;
description = "Database connection settings";
};
pg-config = mkOption {
type = types.attrs;
default = defaults.full-text-search.postgresql.pg-config;
description = "";
};
pg-query-parser = mkOption {
type = types.str;
default = defaults.full-text-search.postgresql.pg-query-parser;
description = "";
};
pg-rank-normalization = mkOption {
type = types.listOf types.int;
default = defaults.full-text-search.postgresql.pg-rank-normalization;
description = "";
};
};
});
default = defaults.full-text-search.postgresql;
description = "PostgreSQL for fulltext search";
};
migration = mkOption {
type = types.submodule({
options = {

View File

@ -62,6 +62,17 @@ let
def-type = "lucene";
q-op = "OR";
};
postgresql = {
use-default-connection = false;
jdbc = {
url = "jdbc:postgresql://server:5432/db";
user = "pguser";
password = "";
};
pg-config = {};
pg-query-parser = "websearch_to_tsquery";
pg-rank-normalization = [ 4 ];
};
};
auth = {
server-secret = "hex:caffee";
@ -575,6 +586,60 @@ in {
default = defaults.full-text-search.solr;
description = "Configuration for the SOLR backend.";
};
postgresql = mkOption {
type = types.submodule({
options = {
use-default-connection = mkOption {
type = types.bool;
default = defaults.full-text-search.postgresql.use-default-connection;
description = "Whether to use the primary db connection.";
};
jdbc = mkOption {
type = types.submodule ({
options = {
url = mkOption {
type = types.str;
default = defaults.jdbc.url;
description = ''
The URL to the database.
'';
};
user = mkOption {
type = types.str;
default = defaults.jdbc.user;
description = "The user name to connect to the database.";
};
password = mkOption {
type = types.str;
default = defaults.jdbc.password;
description = "The password to connect to the database.";
};
};
});
default = defaults.full-text-search.postgresql.jdbc;
description = "Database connection settings";
};
pg-config = mkOption {
type = types.attrs;
default = defaults.full-text-search.postgresql.pg-config;
description = "";
};
pg-query-parser = mkOption {
type = types.str;
default = defaults.full-text-search.postgresql.pg-query-parser;
description = "";
};
pg-rank-normalization = mkOption {
type = types.listOf types.int;
default = defaults.full-text-search.postgresql.pg-rank-normalization;
description = "";
};
};
});
default = defaults.full-text-search.postgresql;
description = "PostgreSQL for fulltext search";
};
};
});
default = defaults.full-text-search;