--- /usr/lib/python3/dist-packages/patroni/postgresql/__init__.py	2022-02-18 13:16:15.000000000 +0000
+++ __init__.py	2022-04-03 19:17:29.952665383 +0000
@@ -798,7 +798,8 @@
         return True
 
     def get_guc_value(self, name):
-        cmd = [self.pgcommand('postgres'), '-D', self._data_dir, '-C', name]
+        cmd = [self.pgcommand('postgres'), '-D', self._data_dir, '-C', name,
+               '--config-file={}'.format(self.config.postgresql_conf)]
         try:
             data = subprocess.check_output(cmd)
             if data:
--- /usr/lib/python3/dist-packages/patroni/postgresql/rewind.py	2022-02-18 13:16:15.000000000 +0000
+++ rewind.py	2022-04-03 19:21:14.479726127 +0000
@@ -314,6 +314,7 @@
         cmd = [self._postgresql.pgcommand('pg_rewind')]
         if self._postgresql.major_version >= 130000 and restore_command:
             cmd.append('--restore-target-wal')
+            cmd.append('--config-file={0}/postgresql.conf'.format(self._postgresql.config._config_dir))
         cmd.extend(['-D', self._postgresql.data_dir, '--source-server', dsn])
 
         while True:
