Skip to content

Commit

Permalink
Avoid use of localhost in derby JDBC URL
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jan 3, 2024
1 parent 0f92f1c commit 8778393
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ public Map<String, String> start() {
container.execInContainer("java", "-Djdbc.drivers=org.apache.derbbc.EmbeddedDriver",
"org.apache.derby.tools.ij", "/init.sql");

return CollectionHelper.mapOf("quarkus.datasource.jdbc.url",
"jdbc:derby://localhost:" + container.getMappedPort(DERBY_PORT) + "/my-db", "timer.period", "100",
"timer.delay",
"0", "timer.repeatCount", "4");
String url = "jdbc:derby://%s:%d/my-db".formatted(container.getHost(), container.getMappedPort(DERBY_PORT));
return CollectionHelper.mapOf(
"quarkus.datasource.jdbc.url", url,
"timer.period", "100",
"timer.delay", "0",
"timer.repeatCount", "4");
} catch (Exception e) {
LOGGER.error("An error occurred while starting the derby container", e);
throw new RuntimeException(e);
Expand Down

0 comments on commit 8778393

Please sign in to comment.