From c1ee36c19edf4440dc076416b5189debac15a55e Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Fri, 6 Jul 2018 01:49:47 -0700 Subject: [PATCH] Export Provider and findFirst (#103) --- src/Network/Minio.hs | 2 ++ src/Network/Minio/Data.hs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/Network/Minio.hs b/src/Network/Minio.hs index d79c11d..0cc6632 100644 --- a/src/Network/Minio.hs +++ b/src/Network/Minio.hs @@ -20,9 +20,11 @@ module Network.Minio ( -- * Credentials Credentials (..) + , Provider , fromAWSConfigFile , fromAWSEnv , fromMinioEnv + , findFirst -- * Connecting to object storage --------------------------------- diff --git a/src/Network/Minio/Data.hs b/src/Network/Minio/Data.hs index d48d6e2..349adbf 100644 --- a/src/Network/Minio/Data.hs +++ b/src/Network/Minio/Data.hs @@ -113,8 +113,11 @@ data Credentials = Credentials { cAccessKey :: Text , cSecretKey :: Text } deriving (Eq, Show) +-- | A Provider is an action that may return Credentials type Provider = IO (Maybe Credentials) +-- | Combines the given list of providers, by calling each one in +-- order until Credentials are found. findFirst :: [Provider] -> Provider findFirst [] = return Nothing findFirst (f:fs) = do c <- f