dalibo / pitrery

DEPRECATED. PostgreSQL Point In Time Recovery made easy
http://dalibo.github.io/pitrery/
Other
108 stars 31 forks source link

Storing PGPASSFILE environment variable in configuration file #155

Closed dmeleedy closed 3 years ago

dmeleedy commented 3 years ago

So in order to run psql we have different passwords for different databases. In order to get pitrery to work correctly we need to set an environment variable PGPASSFILE to point to the .pgpass file related to the password of the database. On one server we have several different databases with different passwords.

So is there a way you could add PGPASSFILE to the configuration file in such a way that it gets exported to the environment automatically when you run pitrery ?

I think the fix is as simple as adding to the load_config() function

export PGPASSFILE

after the other exports, and also adding PGPASSFILE to the default configuration file.

madtibo commented 3 years ago

Bonjour @dmeleedy

I am not sure of the reason why you need to use several different .pgpass file. Is it for security reasons?
You can specify several password in your .pgpass file. If you have different instances, you will be able to specify host/port couples to differentiate them.

You ask the question about using different .pgpass, let's see how we can do that.
Since pitrery is coded in bash and that the configuration file is loaded, the easier and cleanest way to achieve that is, like you said, would be to specify directly your PGPASSFILE value in you pitrery.conf file.

Cordialement,