Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #136 from aslakhellesoy/pass-pg-client

Let me pass in a pg.Client
  • Loading branch information...
commit 7a953a8a30fa0309fa39f0e964235c24dd6ae588 2 parents 02564ee + 54422db
@josephg josephg authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/server/db/pg.coffee
View
4 src/server/db/pg.coffee
@@ -27,6 +27,8 @@ pg = require('pg').native
defaultOptions =
schema: 'sharejs'
+ client: null # An optional instance of pg.Client
+ uri: null # An optional uri for connection
create_tables_automatically: true
operations_table: 'ops'
snapshot_table: 'snapshots'
@@ -37,7 +39,7 @@ module.exports = PgDb = (options) ->
options ?= {}
options[k] ?= v for k, v of defaultOptions
- client = new pg.Client options.uri
+ client = options.client or new pg.Client options.uri
client.connect()
snapshot_table = options.schema and "#{options.schema}.#{options.snapshot_table}" or options.snapshot_table
Please sign in to comment.
Something went wrong with that request. Please try again.