Re: Use environment variables in postgresql.conf

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Use environment variables in postgresql.conf
Date: 2013-12-01 01:06:54
Message-ID: 20131201010653.GB56266@crankycanuck.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Nov 30, 2013 at 06:54:31PM -0500, imagenesis(at)gmail(dot)com wrote:
> Is it possible to use environment variables in postgresql.conf and perhaps
> related configuration files?
>
> For example, I would like to use an env variable to specify the data
> directory.

On top of what John Pierce says in the thread, I would very strongly
urge you not to do this. It makes troubleshooting on failure
notoriously hard. Use the mechanisms the start-up files do, I
suggest.

That said, see section 18 of the manual -- in particular, 18.1.3 in
the 9.3 manual ("Other ways to set parameters"). I recommend against
all that on the basis of some somewhat painful experience, but you can
do it that way.

If you're determined to do it, I _strongly_ suggest using several
different postgres.conf files and then only using the config_file
parameter to control this. At least then you can look at what the
settings were when you have a crashed or otherwise troublesome system.

Best,

A

--
Andrew Sullivan
ajs(at)crankycanuck(dot)ca

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2013-12-01 01:31:34 Re: [GENERAL] pg_upgrade ?deficiency
Previous Message John R Pierce 2013-12-01 00:06:19 Re: Use environment variables in postgresql.conf