3

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?

liliakai
  • 602
  • 7
  • 7
  • What are you trying to do here? You can add things to the database url by manually setting the environment variable, but there are few good reasons to do this. – catsby Apr 02 '13 at 02:51
  • I'm running Discourse which looks for this config in database.yml. – liliakai Apr 02 '13 at 07:11

1 Answers1

2

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.

catsby
  • 11,276
  • 3
  • 37
  • 37
  • Perhaps not, but it was suggested as a possible fix for http://meta.discourse.org/t/password-length-error-when-registering-with-social-account/4670/21 – liliakai Apr 02 '13 at 20:40
  • I think your answer will result in host_names: my.customdomain.com all on one line. Not sure if this will work with discourse which looks at something like config[:host_names].first – liliakai Apr 02 '13 at 20:42
  • 1
    Can you register new users using one of the social network logins? – liliakai Apr 03 '13 at 07:17