future proof AWS.Credentials generation
Avoid breaking when a field is added to the constructor. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
4a42c69092
commit
90f9671e00
1 changed files with 4 additions and 6 deletions
10
Remote/S3.hs
10
Remote/S3.hs
|
@ -33,7 +33,6 @@ import Network.HTTP.Types
|
|||
import Network.URI
|
||||
import Control.Monad.Trans.Resource
|
||||
import Control.Monad.Catch
|
||||
import Data.IORef
|
||||
import Control.Concurrent.STM (atomically)
|
||||
import Control.Concurrent.STM.TVar
|
||||
import Data.Maybe
|
||||
|
@ -1071,11 +1070,10 @@ genericPublicUrl baseurl p =
|
|||
skipescape c = isUnescapedInURIComponent c
|
||||
|
||||
genCredentials :: CredPair -> IO AWS.Credentials
|
||||
genCredentials (keyid, secret) = AWS.Credentials
|
||||
<$> pure (tobs keyid)
|
||||
<*> pure (tobs secret)
|
||||
<*> newIORef []
|
||||
<*> (fmap tobs <$> getEnv "AWS_SESSION_TOKEN")
|
||||
genCredentials (keyid, secret) = do
|
||||
cr <- AWS.makeCredentials (tobs keyid) (tobs secret)
|
||||
tk <- fmap tobs <$> getEnv "AWS_SESSION_TOKEN"
|
||||
return (cr { AWS.iamToken = tk })
|
||||
where
|
||||
tobs = T.encodeUtf8 . T.pack
|
||||
|
||||
|
|
Loading…
Reference in a new issue