Allow configuring the connection pool size

Closes #3165
This commit is contained in:
rijkvanzanten
2021-02-22 20:19:08 -05:00
parent f0ed48d344
commit 81bb7cfa53
2 changed files with 12 additions and 0 deletions

View File

@@ -14,8 +14,11 @@ const connectionConfig: Record<string, any> = getConfigFromEnv('DB_', [
'DB_CLIENT',
'DB_SEARCH_PATH',
'DB_CONNECTION_STRING',
'DB_POOL',
]);
const poolConfig = getConfigFromEnv('DB_POOL');
const knexConfig: Config = {
client: env.DB_CLIENT,
searchPath: env.DB_SEARCH_PATH,
@@ -26,6 +29,7 @@ const knexConfig: Config = {
deprecate: (msg) => logger.info(msg),
debug: (msg) => logger.debug(msg),
},
pool: poolConfig,
};
if (env.DB_CLIENT === 'sqlite3') {

View File

@@ -28,6 +28,7 @@
| `DB_PASSWORD` | Database user's password. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
| `DB_FILENAME` | Where to read/write the SQLite database. **Required** when using `sqlite3`. | -- |
| `DB_CONNECTION_STRING` | When using `pg`, you can submit a connection string instead of individual properties. Using this will ignore any of the other connection settings. | -- |
| `DB_POOL_*` | Pooling settings. Passed on to [the `tarn.js`](https://github.com/vincit/tarn.js#usage) library. | -- |
::: tip Additional Database Variables
@@ -37,6 +38,13 @@ database instance.
:::
::: tip Pooling
All the `DB_POOL_` prefixed options are passed [to `tarn.js`](https://github.com/vincit/tarn.js#usage) through
[Knex](http://knexjs.org/#Installation-pooling)
:::
## Security
| Variable | Description | Default Value |