If you use e.g. AWS Aurora Postgres with IAM authentication it is hard to deal with it in the code.
It would be nice that I can use a function to return the password, like this:
const signer: RDS.Signer = ...
const params: RDS.Signer.SignerOptions = ...
return new pg.Pool({
max: 1,
host: databaseConnection.clusterEndpoint,
port: databaseConnection.port,
database: databaseConnection.database,
user: databaseConnection.username,
password: async () => signer.getAuthToken(params),
ssl: true,
});