File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,15 +75,19 @@ var getLibpgConString = function(config, callback) {
7575 params . push ( "dbname='" + config . database + "'" ) ;
7676 }
7777 if ( config . host ) {
78- if ( config . host != 'localhost' && config . host != '127.0.0.1' ) {
79- //do dns lookup
80- return require ( 'dns' ) . lookup ( config . host , function ( err , address ) {
81- if ( err ) return callback ( err , null ) ;
82- params . push ( "hostaddr=" + address )
83- callback ( null , params . join ( " " ) )
84- } )
78+ if ( ! config . host . indexOf ( "/" ) ) {
79+ params . push ( "host=" + config . host ) ;
80+ } else {
81+ if ( config . host != 'localhost' && config . host != '127.0.0.1' ) {
82+ //do dns lookup
83+ return require ( 'dns' ) . lookup ( config . host , function ( err , address ) {
84+ if ( err ) return callback ( err , null ) ;
85+ params . push ( "hostaddr=" + address )
86+ callback ( null , params . join ( " " ) )
87+ } )
88+ }
89+ params . push ( "hostaddr=127.0.0.1 " ) ;
8590 }
86- params . push ( "hostaddr=127.0.0.1 " ) ;
8791 }
8892 callback ( null , params . join ( " " ) ) ;
8993 } else {
You can’t perform that action at this time.
0 commit comments