|
48 | 48 | name = "readreplica.conf";
|
49 | 49 | path = ../../ansible/files/postgresql_config/custom_read_replica.conf.j2;
|
50 | 50 | };
|
51 |
| - pgHbaConfigFile = builtins.path { |
52 |
| - name = "pg_hba.conf"; |
53 |
| - path = ../../ansible/files/postgresql_config/pg_hba.conf.j2; |
54 |
| - }; |
55 |
| - pgHbaUsersPublicConfigFile = builtins.path { |
56 |
| - name = "pg_hba_users_public.conf"; |
57 |
| - path = ../../ansible/files/postgresql_config/pg_hba_users_public.conf.j2; |
58 |
| - }; |
59 |
| - pgHbaPublicConfigFile = builtins.path { |
60 |
| - name = "pg_hba_public.conf"; |
61 |
| - path = ../../ansible/files/postgresql_config/pg_hba_public.conf.j2; |
62 |
| - }; |
| 51 | + pgHbaConfigFile = |
| 52 | + if pkgs == psql_15 then |
| 53 | + builtins.path { |
| 54 | + name = "pg_hba.conf"; |
| 55 | + path = ../../ansible/files/postgresql_config/pg_hba.conf_15.j2; |
| 56 | + } |
| 57 | + else |
| 58 | + builtins.path { |
| 59 | + name = "pg_hba.conf"; |
| 60 | + path = ../../ansible/files/postgresql_config/pg_hba.conf.j2; |
| 61 | + }; |
| 62 | + pgHbaUsersPublicConfigFile = |
| 63 | + if pkgs != psql_15 then |
| 64 | + builtins.path { |
| 65 | + name = "pg_hba_users_public.conf"; |
| 66 | + path = ../../ansible/files/postgresql_config/pg_hba_users_public.conf.j2; |
| 67 | + } |
| 68 | + else |
| 69 | + null; |
| 70 | + pgHbaPublicConfigFile = |
| 71 | + if pkgs != psql_15 then |
| 72 | + builtins.path { |
| 73 | + name = "pg_hba_public.conf"; |
| 74 | + path = ../../ansible/files/postgresql_config/pg_hba_public.conf.j2; |
| 75 | + } |
| 76 | + else |
| 77 | + null; |
63 | 78 | pgIdentConfigFile = builtins.path {
|
64 | 79 | name = "pg_ident.conf";
|
65 | 80 | path = ../../ansible/files/postgresql_config/pg_ident.conf.j2;
|
|
123 | 138 | cp ${paths.loggingConfigFile} $out/etc/postgresql-custom/logging.conf || { echo "Failed to copy logging.conf"; exit 1; }
|
124 | 139 | cp ${paths.readReplicaConfigFile} $out/etc/postgresql-custom/read-replica.conf || { echo "Failed to copy read-replica.conf"; exit 1; }
|
125 | 140 | cp ${paths.pgHbaConfigFile} $out/etc/postgresql/pg_hba.conf || { echo "Failed to copy pg_hba.conf"; exit 1; }
|
126 |
| - cp ${paths.pgHbaUsersPublicConfigFile} $out/etc/postgresql/pg_hba_users_public.conf || { echo "Failed to copy pg_hba_users_public.conf"; exit 1; } |
127 |
| - cp ${paths.pgHbaPublicConfigFile} $out/etc/postgresql/pg_hba_public.conf || { echo "Failed to copy pg_hba_public.conf"; exit 1; } |
| 141 | +
|
| 142 | + # these shouldn't exist on psql_15 |
| 143 | + if [ -n "${toString paths.pgHbaUsersPublicConfigFile}" ]; then |
| 144 | + cp ${paths.pgHbaUsersPublicConfigFile} $out/etc/postgresql/pg_hba_users_public.conf || { echo "Failed to copy pg_hba_users_public.conf"; exit 1; } |
| 145 | + fi |
| 146 | + if [ -n "${toString paths.pgHbaPublicConfigFile}" ]; then |
| 147 | + cp ${paths.pgHbaPublicConfigFile} $out/etc/postgresql/pg_hba_public.conf || { echo "Failed to copy pg_hba_public.conf"; exit 1; } |
| 148 | + fi |
128 | 149 | cp ${paths.pgIdentConfigFile} $out/etc/postgresql/pg_ident.conf || { echo "Failed to copy pg_ident.conf"; exit 1; }
|
129 | 150 | cp -r ${paths.postgresqlExtensionCustomScriptsPath}/* $out/extension-custom-scripts/ || { echo "Failed to copy custom scripts"; exit 1; }
|
130 | 151 |
|
|
133 | 154 | chmod 644 $out/etc/postgresql/postgresql.conf
|
134 | 155 | chmod 644 $out/etc/postgresql-custom/logging.conf
|
135 | 156 | chmod 644 $out/etc/postgresql/pg_hba.conf
|
136 |
| - chmod 644 $out/etc/postgresql/pg_hba_users_public.conf |
137 |
| - chmod 644 $out/etc/postgresql/pg_hba_public.conf |
| 157 | +
|
| 158 | + if [ -n "${toString paths.pgHbaUsersPublicConfigFile}" ]; then |
| 159 | + chmod 644 $out/etc/postgresql/pg_hba_users_public.conf |
| 160 | + fi |
| 161 | + if [ -n "${toString paths.pgHbaPublicConfigFile}" ]; then |
| 162 | + chmod 644 $out/etc/postgresql/pg_hba_public.conf |
| 163 | + fi |
138 | 164 |
|
139 | 165 | substitute ${../tools/run-server.sh.in} $out/bin/start-postgres-server \
|
140 | 166 | ${
|
|
0 commit comments