Wednesday, 7 August 2013

Unable to access Heroku environment config in dropwizard yaml config file

Unable to access Heroku environment config in dropwizard yaml config file

I have implemented simple REST API using Dropwizard and trying to launch
it on Heroku. I am stuck at the point where I want to access postgresql DB
on Heroku. I am not able to access the configuration on Heroku. I have
config vars set on heroku as below:
$ heroku config
HEROKU_DATABASE_URL:<some value>
HEROKU_DATABASE_USERNAME:<some value>
HEROKU_DATABASE_PASSWORD:<some value>
I am accessing them in my dropwizard app along with other config settings
in config.yml as:
database:
driverClass: org.postgresql.Driver
user: HEROKU_DATABASE_USERNAME
password: HEROKU_DATABASE_PASSWORD
url: jdbc:postgresql:HEROKU_DATABASE_URL
I have also tried :
System.getenv("HEROKU_DATABASE_USERNAME")
But none of these work.
If I substitute with actual values my service works.
Can somebody point me to the correct way of resolving/accessing config
settings from heroku?

No comments:

Post a Comment