Skip to content

Commit 97d6c6e

Browse files
author
Misha Savelyev
committed
Pass service name as application name for postgres connections
1 parent 10e5dc8 commit 97d6c6e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

backend/src/database/models/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ function models() {
5656
credentials.password,
5757
{
5858
dialect: DB_CONFIG.dialect,
59+
dialectOptions: {
60+
application_name: SERVICE,
61+
},
5962
port: DB_CONFIG.port,
6063
replication: {
6164
read: [

services/libs/database/src/connection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const getDbConnection = async (
6363
...config,
6464
max: maxPoolSize || 5,
6565
query_timeout: 30000,
66+
application_name: process.env.SERVICE || 'unknown-app',
6667
})
6768

6869
await dbConnection.connect()

0 commit comments

Comments
 (0)