Is anyone using JOOQ on heroku and with heroku postgres? Here's my 
issue...and it may just be more of a maven question.

So I can just git push heroku master and it pushes all my source and kicks 
off a maven build. This SHOULD invoke my flyway migration and then generate 
JOOQ source. But now I am doing this programmatically in my application 
startup which is not ideal.

There is just one silly reason I do it this way, on all my apps my database 
is on DATABASE_URL which is a heroku style string that includes the driver, 
host, port, username, and password of a database in one HTTP URL string. 

I can't figure out the simple way to parse this in maven and give it to 
JOOQ and Flyway as a JDBC URL with a username and password. I'm not very 
maven savvy.

I *COULD* create a new configuration setting on each heroku app as well as 
my dev machines but then I would have to remember to update 
DATABASE_JDBC_URL every time DATABASE_URL changes.

I know, this is not a huge issue, but it's just one tiny thing I'm stuck on 
and was wondering if any one else solved it in an automated manner. Parsing 
the DATABASE_URL is pretty easy in code, it's just:

URI uri = new URI(databaseURL);

String jdbcUrl =
 String.format(
 "jdbc:%s://%s:%s/%s",
 "postgresql", uri.getHost(), uri.getPort(), uri.getPath().substring(1));

Properties props = new Properties();

String[] credentials = uri.getUserInfo().split(":");
props.setProperty("user", credentials[0]);
props.setProperty("password", credentials[1]);

And it's really only valuable if I can do this for both Flyway AND jOOQ.

Thanks

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to