Using Environment Variables

34 views
Skip to first unread message

Samir Faci

unread,
Apr 18, 2020, 11:06:22 PM4/18/20
to jooq...@googlegroups.com
Hello all,

I pulled most of my DB config for the jooq generator into an xml file.

I have something along these lines:


    <plugin>

    <!-- Specify the maven code generator plugin -->
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <version>${jooq-version}</version>

    <!-- The plugin should hook into the generate goal -->
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
        <configuration>
            <configurationFile>jooq_config.xml</configurationFile>
        </configuration>
    </plugin>


This all works great except now I need to drive the username/password credentials via ENV config.  I tried doing something like this:


<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/social</url>
<user>${POSTGRES_USER}social</user>
<password>${POSTGRES_PASSWORD}</password>
</jdbc>

I tried both ${env.POSTGRES_PASSWORD} and ${POSTGRES_PASSWORD}

is this feasible with Jooq? Or do I need to do something in maven itself.  I know that ${env.VAR_NAME} works in maven, do I need to bring the XML data back into the pom.xml for this pattern to work?


--
Thank you
Samir Faci

Samir Faci

unread,
Apr 18, 2020, 11:13:00 PM4/18/20
to jooq...@googlegroups.com
Scratch that, pulling the config into the maven file works, but it seems the same behavior doesn't work in the config file.


Lukas Eder

unread,
Apr 20, 2020, 4:36:49 AM4/20/20
to jOOQ User Group
Hi Samir,

jOOQ doesn't read any such Maven style environment variables when you don't use Maven to configure jOOQ (e.g. when you use external configuration files).

Thanks,
Lukas

--
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 jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAJ7OkQ8xcZnp3ZTBDtT0j88ZyB6p%3DAODBD%2BmfAdwU_-cD-%3Dsow%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages