@@ -5,16 +5,11 @@ var pg = require('pg')
5
5
6
6
function PostgresDB ( options ) {
7
7
if ( ! ( this instanceof PostgresDB ) ) return new PostgresDB ( options ) ;
8
- if ( typeof options === 'string' ) {
9
- options = {
10
- url : options
11
- }
12
- }
13
8
DB . call ( this , options ) ;
14
9
15
10
this . closed = false ;
16
11
17
- this . pg_url = options . url ;
12
+ this . pg_config = options ;
18
13
} ;
19
14
module . exports = PostgresDB ;
20
15
@@ -45,7 +40,7 @@ PostgresDB.prototype.commit = function(collection, id, op, snapshot, callback) {
45
40
* }
46
41
* snapshot: PostgresSnapshot
47
42
*/
48
- pg . connect ( this . pg_url , function ( err , client , done ) {
43
+ pg . connect ( this . pg_config , function ( err , client , done ) {
49
44
if ( err ) {
50
45
done ( client ) ;
51
46
callback ( err ) ;
@@ -130,7 +125,7 @@ PostgresDB.prototype.commit = function(collection, id, op, snapshot, callback) {
130
125
// snapshot). A snapshot with a version of zero is returned if the docuemnt
131
126
// has never been created in the database.
132
127
PostgresDB . prototype . getSnapshot = function ( collection , id , fields , callback ) {
133
- pg . connect ( this . pg_url , function ( err , client , done ) {
128
+ pg . connect ( this . pg_config , function ( err , client , done ) {
134
129
if ( err ) {
135
130
done ( client ) ;
136
131
callback ( err ) ;
@@ -180,7 +175,7 @@ PostgresDB.prototype.getSnapshot = function(collection, id, fields, callback) {
180
175
//
181
176
// Callback should be called as callback(error, [list of ops]);
182
177
PostgresDB . prototype . getOps = function ( collection , id , from , to , callback ) {
183
- pg . connect ( this . pg_url , function ( err , client , done ) {
178
+ pg . connect ( this . pg_config , function ( err , client , done ) {
184
179
if ( err ) {
185
180
done ( client ) ;
186
181
callback ( err ) ;
0 commit comments