Skip to content

Commit b3a9baa

Browse files
committed
Add default application_name
1 parent 972e8f9 commit b3a9baa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ function parseOptions(url, options = {}) {
382382
const env = process.env // eslint-disable-line
383383

384384
options = Object.assign({
385+
connection: {},
385386
host : env.PGHOST || 'localhost',
386387
port : env.PGPORT || 5432,
387388
database : env.PGDATABASE || 'postgres',
@@ -405,6 +406,9 @@ function parseOptions(url, options = {}) {
405406
options.database = options.db || options.database
406407
options.port = parseInt(options.port)
407408

409+
if ('application_name' in options.connection === false)
410+
options.connection.application_name = 'postgres.js'
411+
408412
if (!options.path && options.host.indexOf('/') > -1)
409413
options.path = options.host + '/.s.PGSQL.' + options.port
410414

0 commit comments

Comments
 (0)