Re: libpq environment variables in the server
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-02-18T13:58:09Z
Lists: pgsql-hackers
Attachments
- v1-0001-Add-GUC-parameter-environment.patch (text/plain) patch v1-0001
- v1-0002-pg_ctl-Add-clear-environment-option.patch (text/plain) patch v1-0002
On 2019-01-21 11:42, Peter Eisentraut wrote: > Maybe pg_ctl should have some functionality to clear the environment, > and maybe there could be a facility in postgresql.conf to set > environment variables. After pondering this, this seemed to be the best solution. Many init systems already clear the environment by default, so that the started services don't have random environment settings inherited from the user. However, you can't easily do this when using pg_ctl directly, so having an option to clear the environment in pg_ctl seems generally useful. Then we can use it in the test suites and thus avoid environment variables leaking in in unintended ways. That revealed that we do need the second mechanism to set environment variables after everything has been cleared. One example in the test suite is LDAPCONF. But there are other cases that could be useful, such as any environment settings that would support archive_command or restore_command. I think this would also be a nice feature in general, so that you can keep all the configuration together in the configuration files and don't have to rely on external mechanisms to inject these environment variables. Attached are two patches that implement these features. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Don't propagate PGAPPNAME through pg_ctl in tests
- 8e93a516e68b 12.0 landed