add debug option for postgresql
This commit is contained in:
parent
62872a1fc1
commit
0c399bb835
1 changed files with 15 additions and 0 deletions
|
@ -4,6 +4,16 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.shb.postgresql = {
|
options.shb.postgresql = {
|
||||||
|
debug = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
description = lib.mdDocs ''
|
||||||
|
Enable debugging options.
|
||||||
|
|
||||||
|
Currently enables shared_preload_libraries = "auto_explain, pg_stat_statements"
|
||||||
|
|
||||||
|
See https://www.postgresql.org/docs/current/pgstatstatements.html'';
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
tcpIPPort = lib.mkOption {
|
tcpIPPort = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.port;
|
type = lib.types.nullOr lib.types.port;
|
||||||
description = "Enable TCP/IP connection on given port.";
|
description = "Enable TCP/IP connection on given port.";
|
||||||
|
@ -86,12 +96,17 @@ in
|
||||||
if (builtins.length cfgsWithPasswords) == 0 then "" else
|
if (builtins.length cfgsWithPasswords) == 0 then "" else
|
||||||
prefix + (lib.concatStrings (map exec cfgsWithPasswords)) + suffix;
|
prefix + (lib.concatStrings (map exec cfgsWithPasswords)) + suffix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debugConfig = enableDebug: lib.mkIf enableDebug {
|
||||||
|
services.postgresql.settings.shared_preload_libraries = "auto_explain, pg_stat_statements";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.mkMerge (
|
lib.mkMerge (
|
||||||
[
|
[
|
||||||
(dbConfig cfg.passwords)
|
(dbConfig cfg.passwords)
|
||||||
(pwdConfig cfg.passwords)
|
(pwdConfig cfg.passwords)
|
||||||
(lib.mkIf (!(isNull cfg.tcpIPPort)) (tcpConfig cfg.tcpIPPort))
|
(lib.mkIf (!(isNull cfg.tcpIPPort)) (tcpConfig cfg.tcpIPPort))
|
||||||
|
(debugConfig cfg.debug)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue