mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
* implemented changes to resolve issue 1170 * added applicationName to the list of db options in the documentation' Co-authored-by: Daniele Casal <daniele.casal@lloydsbanking.com> Co-authored-by: Sukhvinder Panesar <79143027+esspee-lbg@users.noreply.github.com>
This commit is contained in:
parent
2f59426851
commit
7ddbff2669
@ -11,6 +11,7 @@ Object {
|
|||||||
},
|
},
|
||||||
"db": Object {
|
"db": Object {
|
||||||
"acquireConnectionTimeout": 30000,
|
"acquireConnectionTimeout": 30000,
|
||||||
|
"applicationName": "unleash",
|
||||||
"database": "unleash_db",
|
"database": "unleash_db",
|
||||||
"disableMigration": false,
|
"disableMigration": false,
|
||||||
"driver": "postgres",
|
"driver": "postgres",
|
||||||
|
@ -95,6 +95,7 @@ const defaultDbOptions: IDBOption = {
|
|||||||
},
|
},
|
||||||
schema: process.env.DATABASE_SCHEMA || 'public',
|
schema: process.env.DATABASE_SCHEMA || 'public',
|
||||||
disableMigration: false,
|
disableMigration: false,
|
||||||
|
applicationName: process.env.DATABASE_APPLICATION_NAME || 'unleash',
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultSessionOption: ISessionOption = {
|
const defaultSessionOption: ISessionOption = {
|
||||||
|
@ -9,7 +9,10 @@ export function createDb({
|
|||||||
return knex({
|
return knex({
|
||||||
client: 'pg',
|
client: 'pg',
|
||||||
version: db.version,
|
version: db.version,
|
||||||
connection: db,
|
connection: {
|
||||||
|
...db,
|
||||||
|
application_name: db.applicationName,
|
||||||
|
},
|
||||||
pool: db.pool,
|
pool: db.pool,
|
||||||
searchPath: db.schema,
|
searchPath: db.schema,
|
||||||
asyncStackTraces: true,
|
asyncStackTraces: true,
|
||||||
|
@ -30,6 +30,7 @@ export interface IDBOption {
|
|||||||
};
|
};
|
||||||
schema: string;
|
schema: string;
|
||||||
disableMigration: boolean;
|
disableMigration: boolean;
|
||||||
|
applicationName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISessionOption {
|
export interface ISessionOption {
|
||||||
|
@ -16,6 +16,7 @@ process.nextTick(async () => {
|
|||||||
database: process.env.UNLEASH_DATABASE_NAME || 'unleash',
|
database: process.env.UNLEASH_DATABASE_NAME || 'unleash',
|
||||||
schema: process.env.UNLEASH_DATABASE_SCHEMA,
|
schema: process.env.UNLEASH_DATABASE_SCHEMA,
|
||||||
ssl: false,
|
ssl: false,
|
||||||
|
applicationName: 'unleash',
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
enableRequestLogger: true,
|
enableRequestLogger: true,
|
||||||
|
@ -205,6 +205,7 @@ The available options are listed in the table below. Options can be specified ei
|
|||||||
| `pool.min` | `DATABASE_POOL_MIN` | 0 | The minimum number of connections in the connection pool. |
|
| `pool.min` | `DATABASE_POOL_MIN` | 0 | The minimum number of connections in the connection pool. |
|
||||||
| `pool.max` | `DATABASE_POOL_MAX` | 4 | The maximum number of connections in the connection pool. |
|
| `pool.max` | `DATABASE_POOL_MAX` | 4 | The maximum number of connections in the connection pool. |
|
||||||
| `pool.idleTimeoutMillis` | `DATABASE_POOL_IDLE_TIMEOUT_MS` | 30000 | The amount of time (in milliseconds) that a connection must be idle for before it is marked as a candidate for eviction. |
|
| `pool.idleTimeoutMillis` | `DATABASE_POOL_IDLE_TIMEOUT_MS` | 30000 | The amount of time (in milliseconds) that a connection must be idle for before it is marked as a candidate for eviction. |
|
||||||
|
| `applicationName` | `DATABASE_APPLICATION_NAME` | `unleash` | The name of the application that created this Client instance. |
|
||||||
|
|
||||||
Alternatively, you can use a [libpq connection string](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) to connect to the database. You can provide it directly or from a file by using one of the below options. In JavaScript, these are top-level properties of the root configuration object, *not* the `db` object.
|
Alternatively, you can use a [libpq connection string](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) to connect to the database. You can provide it directly or from a file by using one of the below options. In JavaScript, these are top-level properties of the root configuration object, *not* the `db` object.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user