heroku DATABASE_URL
On heroku, how to get the whole value of DATABASE_URL ?
When I issue a
her开发者_如何学Coku config --app APP_NAME
I get several config parameters but the DATABASE_URL is not entirely visible
DATABASE_URL => postgres://ruhej...s.com/oeuhenchej
Any idea ?
$ heroku config --app APP_NAME
(The Heroku toolbelt has been updated since the question was asked; the command now shows the entire DATABASE_URL
.)
$ heroku pg:credentials:url YOUR_DATABASE_NAME
Gives you all the informations needed (url, port, dbname, user, password):
Connection information for default credential.
Connection info string:
"dbname=xxxxxxxxxxxxxx host=yyyyyyyyyyyyyyyyyyyyyyyyyyy.amazonaws.com port=5432 user=zzzzzzzzzzzzzz password=************* sslmode=require"
Connection URL:
postgres://zzzzzzzzzzzzzz:*************@yyyyyyyyyyyyyyyyyyyyyyyyyyy.amazonaws.com:5432/xxxxxxxxxxxxxx
This may seem really basic but your heroku APP_NAME is app_name.heroku.com. You can find that by logging into heroku.com and looking in your account. In order to get your app config variables you simply type into the console:
heroku config --app APP_NAME
To get the full database URL, use config:get
from the Heroku CLI;
heroku config:get DATABASE_URL -a my-app-name
To get PostgreSQL dump file from heroku :-
heroku pg:backups:capture
heroku pg:backups
it shows all the backups
heroku pg:backups:url BackupID
精彩评论