diff options
Diffstat (limited to 'modules/private/databases/postgresql_replication.nix')
-rw-r--r-- | modules/private/databases/postgresql_replication.nix | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/modules/private/databases/postgresql_replication.nix b/modules/private/databases/postgresql_replication.nix index b103b8c..135bbed 100644 --- a/modules/private/databases/postgresql_replication.nix +++ b/modules/private/databases/postgresql_replication.nix | |||
@@ -62,9 +62,8 @@ in | |||
62 | users.groups.postgres.gid = config.ids.gids.postgres; | 62 | users.groups.postgres.gid = config.ids.gids.postgres; |
63 | environment.systemPackages = [ cfg.mainPackage ]; | 63 | environment.systemPackages = [ cfg.mainPackage ]; |
64 | 64 | ||
65 | secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ | 65 | secrets.keys = lib.listToAttrs (lib.flatten (lib.mapAttrsToList (name: hcfg: [ |
66 | { | 66 | (lib.nameValuePair "postgresql_replication/${name}/recovery.conf" { |
67 | dest = "postgresql_replication/${name}/recovery.conf"; | ||
68 | user = "postgres"; | 67 | user = "postgres"; |
69 | group = "postgres"; | 68 | group = "postgres"; |
70 | permissions = "0400"; | 69 | permissions = "0400"; |
@@ -73,16 +72,14 @@ in | |||
73 | primary_conninfo = '${hcfg.connection}?sslmode=require' | 72 | primary_conninfo = '${hcfg.connection}?sslmode=require' |
74 | primary_slot_name = '${hcfg.slot}' | 73 | primary_slot_name = '${hcfg.slot}' |
75 | ''; | 74 | ''; |
76 | } | 75 | }) |
77 | { | 76 | (lib.nameValuePair "postgresql_replication/${name}/connection_string" { |
78 | dest = "postgresql_replication/${name}/connection_string"; | ||
79 | user = "postgres"; | 77 | user = "postgres"; |
80 | group = "postgres"; | 78 | group = "postgres"; |
81 | permissions = "0400"; | 79 | permissions = "0400"; |
82 | text = hcfg.connection; | 80 | text = hcfg.connection; |
83 | } | 81 | }) |
84 | { | 82 | (lib.nameValuePair "postgresql_replication/${name}/postgresql.conf" { |
85 | dest = "postgresql_replication/${name}/postgresql.conf"; | ||
86 | user = "postgres"; | 83 | user = "postgres"; |
87 | group = "postgres"; | 84 | group = "postgres"; |
88 | permissions = "0400"; | 85 | permissions = "0400"; |
@@ -94,8 +91,8 @@ in | |||
94 | data_directory = '${dataDir}' | 91 | data_directory = '${dataDir}' |
95 | wal_level = logical | 92 | wal_level = logical |
96 | ''; | 93 | ''; |
97 | } | 94 | }) |
98 | ]) cfg.hosts); | 95 | ]) cfg.hosts)); |
99 | 96 | ||
100 | services.cron = { | 97 | services.cron = { |
101 | enable = true; | 98 | enable = true; |