We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dd6859a + a243bea commit d92fa59Copy full SHA for d92fa59
cardano-db/src/Cardano/Db/PGConfig.hs
@@ -1,4 +1,5 @@
1
{-# LANGUAGE OverloadedStrings #-}
2
+{-# LANGUAGE ScopedTypeVariables #-}
3
4
module Cardano.Db.PGConfig
5
( PGConfig (..)
@@ -79,8 +80,12 @@ readPGPassFile (PGPassFile fpath) = do
79
80
replaceUser pgc
81
| pgcUser pgc /= "*" = pure pgc
82
| otherwise = do
- user <- getEffectiveUserName
83
- pure $ pgc { pgcUser = BS.pack user }
+ euser <- Exception.try getEffectiveUserName
84
+ case euser of
85
+ Left (_ :: IOException) ->
86
+ error "readPGPassFile: User in pgpass file was specified as '*' but getEffectiveUserName failed."
87
+ Right user ->
88
+ pure $ pgc { pgcUser = BS.pack user }
89
90
91
-- | Read 'PGPassFile' into 'PGConfig'.
0 commit comments