Skip to content

Commit dc328d8

Browse files
author
gege251
committed
Simplify signing key file pattern match
1 parent 7cc1c89 commit dc328d8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/BotPlutusInterface/Files.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ import Plutus.V1.Ledger.Api (
8383
)
8484
import PlutusTx (ToData, toData)
8585
import PlutusTx.Builtins (fromBuiltin)
86-
import System.FilePath (isExtensionOf, (</>))
86+
import System.FilePath (takeExtension, (</>))
8787
import Prelude
8888

8989
-- | Filename of a minting policy script
@@ -183,11 +183,10 @@ readPrivateKeys pabConf = do
183183
<$> mapM
184184
( \filename ->
185185
let fullPath = Text.unpack pabConf.pcSigningKeyFileDir </> filename
186-
in case filename of
187-
_
188-
| "vkey" `isExtensionOf` filename -> Just <$> readVerificationKey @w fullPath
189-
| "skey" `isExtensionOf` filename -> Just <$> readSigningKey @w fullPath
190-
| otherwise -> pure Nothing
186+
in case takeExtension filename of
187+
".vkey" -> Just <$> readVerificationKey @w fullPath
188+
".skey" -> Just <$> readSigningKey @w fullPath
189+
_ -> pure Nothing
191190
)
192191
files
193192

0 commit comments

Comments
 (0)