Connect to a datasource through environment variable

Hi there,

I was wondering if there is a way to connect to multiple data sources through an environment variable?

Context

At the moment, for security best practices the credential to the database is being rotated. The current way to connect to a data source is through the web form and it needs the username and password to the database. When the credential is rotated, this connection will be broken and we have to manually update the credential.

When we use Heroku, Heroku takes care of the rotated credential through an environment variable. This allows us to automate connection refresh with the new credential.

Any help or guidance would be appreciated.

Thank you,
Rendy