Skip to content

Commit cbeaa50

Browse files
authored
Add support for application_name (#24)
#fix #23 https://node-postgres.com/api/client
1 parent d421496 commit cbeaa50

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

locales/en-US/postgresql.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ssl": "SSL",
99
"user": "User",
1010
"password": "Password",
11+
"applicationName": "Application name",
1112
"max": "Maximum size",
1213
"idle": "Idle Timeout",
1314
"connectionTimeout": "Connection Timeout",
@@ -23,6 +24,7 @@
2324
"database": "dbExample",
2425
"user": "dbUser",
2526
"password": "dbPassword",
27+
"applicationName": "",
2628
"max": "10",
2729
"idle": "1000 (Milliseconds)",
2830
"connectionTimeout": "10000 (Milliseconds)"
@@ -33,6 +35,7 @@
3335
"pool": "Pool"
3436
},
3537
"title": {
38+
"applicationName": "The name of the application that created this Client instance.",
3639
"max": "Maximum number of physical database connections that this connection pool can contain."
3740
}
3841
}

postgresql.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
</div>
6262
</div>
6363
<div id="postgresql-config-tab-pool" style="display: none;">
64+
<div class="form-row">
65+
<label data-i18n="[title]postgresql.title.applicationName" for="node-config-input-applicationName">
66+
<i class="fa fa-tag"></i>
67+
<span data-i18n="postgresql.label.applicationName"></span>
68+
</label>
69+
<input type="text" id="node-config-input-applicationName" data-i18n="[placeholder]postgresql.placeholder.applicationName" style="width: 80%;" />
70+
<input type="hidden" id="node-config-input-applicationNameType" />
71+
</div>
6472
<div class="form-row">
6573
<label data-i18n="[title]postgresql.title.max" for="node-config-input-max" style="width: 150px;">
6674
<i class="fa fa-thermometer-full"></i>
@@ -121,6 +129,12 @@
121129
sslFieldType: {
122130
value: 'bool',
123131
},
132+
applicationName: {
133+
value: '',
134+
},
135+
applicationNameType: {
136+
value: 'str',
137+
},
124138
max: {
125139
value: 10,
126140
},
@@ -210,6 +224,11 @@
210224
types: ['str', 'global', 'env'],
211225
typeField: $('#node-config-input-passwordFieldType'),
212226
});
227+
$('#node-config-input-applicationName').typedInput({
228+
default: 'str',
229+
types: ['str', 'global', 'env'],
230+
typeField: $('#node-config-input-applicationNameType'),
231+
});
213232
$('#node-config-input-max').typedInput({
214233
default: 'num',
215234
types: ['num', 'global'],

postgresql.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ module.exports = function (RED) {
6363
node.databaseFieldType = n.databaseFieldType;
6464
node.ssl = n.ssl;
6565
node.sslFieldType = n.sslFieldType;
66+
node.applicationName = n.applicationName;
67+
node.applicationNameType = n.applicationNameType;
6668
node.max = n.max;
6769
node.maxFieldType = n.maxFieldType;
6870
node.idle = n.idle;
@@ -81,6 +83,7 @@ module.exports = function (RED) {
8183
port: getField(node, n.portFieldType, n.port),
8284
database: getField(node, n.databaseFieldType, n.database),
8385
ssl: getField(node, n.sslFieldType, n.ssl),
86+
application_name: getField(node, n.applicationNameType, n.applicationName),
8487
max: getField(node, n.maxFieldType, n.max),
8588
idleTimeoutMillis: getField(node, n.idleFieldType, n.idle),
8689
connectionTimeoutMillis: getField(node, n.connectionTimeoutFieldType, n.connectionTimeout),

0 commit comments

Comments
 (0)