File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -490,7 +490,7 @@ function parseOptions(a, b) {
490
490
port,
491
491
path : o . path || host . indexOf ( '/' ) > - 1 && host + '/.s.PGSQL.' + port ,
492
492
database : o . database || o . db || ( url . pathname || '' ) . slice ( 1 ) || env . PGDATABASE || 'postgres' ,
493
- user : o . user || o . username || auth [ 0 ] || env . PGUSERNAME || env . PGUSER || os . userInfo ( ) . username ,
493
+ user : o . user || o . username || auth [ 0 ] || env . PGUSERNAME || env . PGUSER || osUsername ( ) ,
494
494
pass : o . pass || o . password || auth [ 1 ] || env . PGPASSWORD || '' ,
495
495
max : o . max || url . query . max || Math . max ( 1 , os . cpus ( ) . length ) ,
496
496
types : o . types || { } ,
@@ -505,3 +505,11 @@ function parseOptions(a, b) {
505
505
mergeUserTypes ( o . types )
506
506
)
507
507
}
508
+
509
+ function osUsername ( ) {
510
+ try {
511
+ return require ( 'os' ) . userInfo ( ) . username // eslint-disable-line
512
+ } catch ( _ ) {
513
+ return
514
+ }
515
+ }
You can’t perform that action at this time.
0 commit comments