I'm coming here to ask how to handle the credentials rotating in my JS app? Am I able to make an API request to get the credentials? I've looked at quite a few topics but none give direct answers so I hoped I'd ask for myself.
You don't handle it explicitly. Your application should access your Heroku Postgres database through the DATABASE_URL
environment variable (or other environment variable created by Heroku, if applicable).
When changes occur to the active database service or to the assigned credential, or if you perform an explicit rotation, Heroku restarts your app and provides the new values via environment variable.
-
-
The username and password are stored in the
DATABASE_URL
environment variable, which different environments consume in different ways. There are examples for various stacks, including Node.js, in the Heroku documentation – David Reed♦ Sep 13 '20 at 2:01 -