Skip to content

Commit

Permalink
simplify configuration for postgres connection; rename postgresql to …
Browse files Browse the repository at this point in the history
…postgres;
  • Loading branch information
majguo committed Jun 18, 2020
1 parent acc87fb commit e663cb9
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: openliberty.io/v1beta1
kind: OpenLibertyApplication
metadata:
name: javaee-cafe-connect-db-postgresql
name: javaee-cafe-connect-db-postgres
namespace: open-liberty-demo
spec:
replicas: 1
# Note: replace "${Your_DockerHub_Account}" with your Docker Hub account name
applicationImage: docker.io/${Your_DockerHub_Account}/javaee-cafe-connect-db-postgresql:latest
applicationImage: docker.io/${Your_DockerHub_Account}/javaee-cafe-connect-db-postgres:latest
expose: true
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<failOnMissingWebXml>false</failOnMissingWebXml>
<postgresql.server.name></postgresql.server.name>
<postgresql.user></postgresql.user>
<postgresql.password></postgresql.password>
<db.server.name></db.server.name>
<db.port.number></db.port.number>
<db.name></db.name>
<db.user></db.user>
<db.password></db.password>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -71,9 +73,11 @@
<libertyRuntimeVersion>[20.0.0.1,)</libertyRuntimeVersion>
<outputDirectory>${project.build.directory}/wlp-package</outputDirectory>
<bootstrapProperties>
<postgresql.server.name>${postgresql.server.name}</postgresql.server.name>
<postgresql.user>${postgresql.user}</postgresql.user>
<postgresql.password>${postgresql.password}</postgresql.password>
<db.server.name>${db.server.name}</db.server.name>
<db.port.number>${db.port.number}</db.port.number>
<db.name>${db.name}</db.name>
<db.user>${db.user}</db.user>
<db.password>${db.password}</db.password>
</bootstrapProperties>
</configuration>
</execution>
Expand All @@ -85,7 +89,7 @@
<version>3.1.2</version>
<executions>
<execution>
<id>copy-postgresql-driver</id>
<id>copy-jdbc-driver</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@
location="${server.config.dir}/apps/javaee-cafe.war">
</webApplication>

<dataSource id="JavaEECafeDB"
jdbcDriverRef="postgresql-driver" jndiName="jdbc/JavaEECafeDB"
transactional="true" type="javax.sql.ConnectionPoolDataSource">
<properties databaseName="postgres" portNumber="5432"
serverName="${postgresql.server.name}" user="${postgresql.user}"
password="${postgresql.password}" />
<dataSource id="JavaEECafeDB" jndiName="jdbc/JavaEECafeDB">
<jdbcDriver libraryRef="driver-library" />
<properties.postgresql
serverName="${db.server.name}"
portNumber="${db.port.number}"
databaseName="${db.name}"
user="${db.user}"
password="${db.password}" />
</dataSource>

<jdbcDriver id="postgresql-driver"
javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
libraryRef="postgresql-library" />

<library id="postgresql-library">
<fileset dir="${shared.resource.dir}"
id="PostgreSQLFileset" includes="postgresql-42.2.4.jar" />
<library id="driver-library">
<fileset dir="${shared.resource.dir}" includes="*.jar" />
</library>
</server>

0 comments on commit e663cb9

Please sign in to comment.