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 Network.URI
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
import Control.Monad.Catch
|
import Control.Monad.Catch
|
||||||
import Data.IORef
|
|
||||||
import Control.Concurrent.STM (atomically)
|
import Control.Concurrent.STM (atomically)
|
||||||
import Control.Concurrent.STM.TVar
|
import Control.Concurrent.STM.TVar
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
@ -1071,11 +1070,10 @@ genericPublicUrl baseurl p =
|
||||||
skipescape c = isUnescapedInURIComponent c
|
skipescape c = isUnescapedInURIComponent c
|
||||||
|
|
||||||
genCredentials :: CredPair -> IO AWS.Credentials
|
genCredentials :: CredPair -> IO AWS.Credentials
|
||||||
genCredentials (keyid, secret) = AWS.Credentials
|
genCredentials (keyid, secret) = do
|
||||||
<$> pure (tobs keyid)
|
cr <- AWS.makeCredentials (tobs keyid) (tobs secret)
|
||||||
<*> pure (tobs secret)
|
tk <- fmap tobs <$> getEnv "AWS_SESSION_TOKEN"
|
||||||
<*> newIORef []
|
return (cr { AWS.iamToken = tk })
|
||||||
<*> (fmap tobs <$> getEnv "AWS_SESSION_TOKEN")
|
|
||||||
where
|
where
|
||||||
tobs = T.encodeUtf8 . T.pack
|
tobs = T.encodeUtf8 . T.pack
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue