Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure DATABASE_URL to add a list of host_names to database.yml on heroku?

Heroku generates database.yml from the DATABASE_URL environment variable like so: https://gist.github.com/liliakai/c161ad5704be04e88999

I'd like the resulting database.yml to include the line

host_names:  
  - my.customdomain.com

How would I encode this into the query string on the DATABASE_URL?

like image 704
liliakai Avatar asked Feb 01 '26 03:02

liliakai


1 Answers

You can manually set attributes on the DATABASE_URL like so

$ heroku config:get DATABASE_URL
[copy returned value]
$ heroku config:set DATABASE_URL=[paste value]?host_names=my.customdomain.com

Note that this is fragile; promoting a new database, or reseting the credentials, will reset the DATABASE_URL. These kinds of additions will also cause the Heroku pgbackups add-on to not work.

Finally, this is not required for Discourse on Heroku – I just setup Discourse myself and didn't need it.

like image 162
catsby Avatar answered Feb 02 '26 19:02

catsby