Re: libpq environment variables in the server - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: libpq environment variables in the server
Date
Msg-id 744962da-c27f-c992-4058-364463857ee0@2ndquadrant.com
Whole thread Raw
In response to libpq environment variables in the server  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: libpq environment variables in the server  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Ramanarayana
Date:
Subject: Re: libpq debug log
Next
From: Alvaro Herrera
Date:
Subject: Re: Progress reporting for pg_verify_checksums