Skip to content

Commit 7883aa5

Browse files
committed
Added check for duplicate connectio name
1 parent 0f6e090 commit 7883aa5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function fastifyPostgres (fastify, options, next) {
2929
fastify.decorate('pg', {})
3030
}
3131

32+
if (fastify.pg[name]) {
33+
next(new Error('Connection name has already been registered: ' + name))
34+
}
35+
3236
fastify.pg[name] = db
3337
} else {
3438
if (fastify.pg) {

0 commit comments

Comments
 (0)