Reputation: 1083
Is there a command that gets the name of the current Postgres in a Heroku application? I am writing a batch file that should be used in multiple stages of my application. Each time the only difference is the name of the database. Using heroku pg, I could retrieve the complete URL of the database:
heroku pg:credentials:url DATABASE
Maybe I could extract the name from the URL using some Linux tools, but in the context of batch files, I prefer not to use anything but Heroku tools to keep environment independency.
Upvotes: 0
Views: 878
Reputation: 3365
Heroku doesn't provide a parsed version of $DATABASE_URL
(which you can also get with heroku config:get DATABASE_URL
. If you need the database name, you'll need to parse it yourself or use a tool to do so.
Upvotes: 1