Thanks that will work as long as I can read it from the ENVIRONMENT and 
nothing goes into the src/main/resources directory that has any database 
information. But if it's just patterns in there that could work. I'll take 
a look at the examples.

On Wednesday, January 14, 2015 at 10:43:45 PM UTC-8, Lukas Eder wrote:
>
> Instead of parsing a pre-composed URL, I'd suggest composing the different 
> URLs from their parts and loading the parts from an external properties 
> file.
>
> I've also given this answer to your question on Stack Overflow:
> http://stackoverflow.com/q/27954841/521799
>
> For the record, I'll also post it here:
>
> There are probably myriad ways to solve this with Maven, but one option is 
> to keep a single properties file in your /src/main/resources path, load 
> it using the properties-maven-plugin 
> <http://mojo.codehaus.org/properties-maven-plugin/> (an example can be 
> seen in the jOOQ-Spring example 
> <https://github.com/jOOQ/jOOQ/tree/master/jOOQ-examples/jOOQ-spring-example>),
>  
> and then compose URLs using the individual parts, e.g. jOOQ and Flyway:
>
> <url>jdbc:postgresql://${db.host}:${db.port}/${db.database}</url><user>${db.username}</user><password>${db.password}</password>
>
> Heroku:
>
> <database_url>postgres://${db.username}:${db.password}@${db.host}:${db.port}/${db.databa
>
>
> Cheers
> Lukas
>
> 2015-01-15 1:09 GMT+01:00 Robert DiFalco <[email protected] 
> <javascript:>>:
>
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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