mirror of
https://github.com/sismics/docs.git
synced 2024-12-21 10:53:49 +01:00
Allow to specify a pool size (#727)
This commit is contained in:
parent
0351f94761
commit
f9b5a5212d
@ -81,6 +81,7 @@ To build external URL, the server is expecting a `DOCS_BASE_URL` environment var
|
||||
- `DATABASE_URL`: The jdbc connection string to be used by `hibernate`.
|
||||
- `DATABASE_USER`: The user which should be used for the database connection.
|
||||
- `DATABASE_PASSWORD`: The password to be used for the database connection.
|
||||
- `DATABASE_POOL_SIZE`: The pool size to be used for the database connection.
|
||||
|
||||
- Language
|
||||
- `DOCS_DEFAULT_LANGUAGE`: The language which will be used as default. Currently supported values are:
|
||||
@ -122,6 +123,7 @@ services:
|
||||
DATABASE_URL: "jdbc:postgresql://teedy-db:5432/teedy"
|
||||
DATABASE_USER: "teedy_db_user"
|
||||
DATABASE_PASSWORD: "teedy_db_password"
|
||||
DATABASE_POOL_SIZE: "10"
|
||||
volumes:
|
||||
- ./docs/data:/data
|
||||
networks:
|
||||
|
@ -79,6 +79,10 @@ public final class EMF {
|
||||
String databaseUrl = System.getenv("DATABASE_URL");
|
||||
String databaseUsername = System.getenv("DATABASE_USER");
|
||||
String databasePassword = System.getenv("DATABASE_PASSWORD");
|
||||
String databasePoolSize = System.getenv("DATABASE_POOL_SIZE");
|
||||
if(databasePoolSize == null) {
|
||||
databasePoolSize = "10";
|
||||
}
|
||||
|
||||
log.info("Configuring EntityManager from environment parameters");
|
||||
Properties props = new Properties();
|
||||
@ -103,7 +107,7 @@ public final class EMF {
|
||||
props.put("hibernate.max_fetch_depth", "5");
|
||||
props.put("hibernate.cache.use_second_level_cache", "false");
|
||||
props.put("hibernate.connection.initial_pool_size", "1");
|
||||
props.put("hibernate.connection.pool_size", "10");
|
||||
props.put("hibernate.connection.pool_size", databasePoolSize);
|
||||
props.put("hibernate.connection.pool_validation_interval", "5");
|
||||
return props;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user