简体   繁体   English

如何使用最新凭据从外部应用程序访问 Heroku Postgres DB?

[英]How do I access Heroku Postgres DB from an external application using latest credentials?

I am building an ETL Application that needs to fetch data from Heroku Postgres DB a few times a day but the application is not running on Heroku, I am already able to do this, but using the current credentials, but heroku states that the credentials are not permanent and will be rotated from time to time.我正在构建一个 ETL 应用程序,它需要每天从 Heroku Postgres DB 获取数据几次,但该应用程序没有在 Heroku 上运行,我已经能够做到这一点,但是使用当前的凭据,但 heroku 声明凭据是不是永久性的,将不时轮换。

What is the best way to do this, building a REST API on top of my app is not viable an option.最好的方法是什么,在我的应用程序之上构建 REST API 是不可行的选择。 I have seen that Heroku provides a config vars API which I could potentially use to fetch the DB credentials, but is there a simpler/cleaner way for implementing this, is enforcing permanent credentials an option?我已经看到 Heroku 提供了一个config vars API ,我可能会用它来获取数据库凭据,但是有没有更简单/更清晰的方法来实现这一点,是否可以选择强制执行永久凭据?

There is no way to enforce it.没有办法强制执行它。 And it's not a question of credentials, but a question of a database hostname.这不是凭据问题,而是数据库主机名问题。 It's ec2.这是ec2。

Your safest bet is to always fetch current DATABASE_URL from your Heroku app.最安全的做法是始终从 Heroku 应用中获取当前的DATABASE_URL If you only need to do it 'a few times a day' this is not a problem.如果您只需要“一天几次”,这不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM