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.
1 Answer
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.
-
How would this manage user and password? Thanks for the responseJohn– John2020-09-12 23:54:22 +00:00Commented Sep 12, 2020 at 23:54
-
The username and password are stored in the
DATABASE_URLenvironment variable, which different environments consume in different ways. There are examples for various stacks, including Node.js, in the Heroku documentationDavid Reed– David Reed2020-09-13 02:01:15 +00:00Commented Sep 13, 2020 at 2:01 -