From dd36e08d7d6cd8248f12a9570694b4631be3b04d Mon Sep 17 00:00:00 2001 From: bgamard Date: Sat, 22 Apr 2023 00:47:01 +0200 Subject: [PATCH] #680: warning when using H2 database --- README.md | 2 +- docs-core/src/main/java/com/sismics/util/jpa/EMF.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b4309a8e..69461826 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ A demo is available at [demo.teedy.io](https://demo.teedy.io) # Install with Docker -A preconfigured Docker image is available, including OCR and media conversion tools, listening on port 8080. If no PostgreSQL config is provided, the database is an embedded H2 database. The H2 embedded database should only be used for testing. For production usage use the provided postgreSQL configuration (check the docker-compose example) +A preconfigured Docker image is available, including OCR and media conversion tools, listening on port 8080. If no PostgreSQL config is provided, the database is an embedded H2 database. The H2 embedded database should only be used for testing. For production usage use the provided PostgreSQL configuration (check the Docker Compose example) **The default admin password is "admin". Don't forget to change it before going to production.** diff --git a/docs-core/src/main/java/com/sismics/util/jpa/EMF.java b/docs-core/src/main/java/com/sismics/util/jpa/EMF.java index 77708465..401bb424 100644 --- a/docs-core/src/main/java/com/sismics/util/jpa/EMF.java +++ b/docs-core/src/main/java/com/sismics/util/jpa/EMF.java @@ -85,6 +85,7 @@ public final class EMF { Path dbDirectory = DirectoryUtil.getDbDirectory(); String dbFile = dbDirectory.resolve("docs").toAbsolutePath().toString(); if (Strings.isNullOrEmpty(databaseUrl)) { + log.warn("Using an embedded H2 database. Only suitable for testing purpose, not for production!"); props.put("hibernate.connection.driver_class", "org.h2.Driver"); props.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); props.put("hibernate.connection.url", "jdbc:h2:file:" + dbFile + ";CACHE_SIZE=65536;LOCK_TIMEOUT=10000");