Book Image

Learning Heroku Postgres

By : Patrick Rafael de Oliveira Espake
Book Image

Learning Heroku Postgres

By: Patrick Rafael de Oliveira Espake

Overview of this book

Table of Contents (17 chapters)
Learning Heroku Postgres
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Keyword List
Index

Connecting to databases from outside Heroku


In some cases, you may want your application to connect to a database that isn't hosted in Heroku. You can configure this connection by overriding the DATABASE_URL command.

To override this variable, you must provide the connection parameters:

postgres://[username]:[password]@[host]/[database name]

The Heroku client has the config:set command that allows you to define or override environment variables:

$ heroku config:set DATABASE_URL=' postgres://[username]:[password]@[host]/[database name]' -your-app-name
Setting config vars and restarting your-app-name... done, v11
DATABASE_URL: postgres://[username]:[password] @[host]:5432/[database name]