diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-25 13:14:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-25 13:14:49 -0400 |
commit | a3b1c322a243bf6f9a603771a4db253474424608 (patch) | |
tree | cddc14d835fe78523f6f97bbe33387080750d9de /Remote | |
parent | 9676d206217f93dbc8da215fb0c0214730b22e09 (diff) |
support enabling IA repositories
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/S3.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs index 00b5b5dc6..72bcd1a58 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module Remote.S3 (remote) where +module Remote.S3 (remote, iaHost, isIAHost) where import Network.AWS.AWSConnection import Network.AWS.S3Object @@ -15,6 +15,7 @@ import qualified Data.Text as T import qualified Data.ByteString.Lazy.Char8 as L import qualified Data.Map as M import Data.Char +import Network.Socket (HostName) import Common.Annex import Types.Remote @@ -81,7 +82,7 @@ s3Setup u c = handlehost $ M.lookup "host" c handlehost Nothing = defaulthost handlehost (Just h) - | ".archive.org" `isSuffixOf` map toLower h = archiveorg + | isIAHost h = archiveorg | otherwise = defaulthost use fullconfig = do @@ -270,3 +271,10 @@ s3Connection c u = go =<< getRemoteCredPairFor "S3" c (AWS.creds u) case reads s of [(p, _)] -> p _ -> error $ "bad S3 port value: " ++ s + +{- Hostname to use for archive.org S3. -} +iaHost :: HostName +iaHost = "s3.us.archive.org" + +isIAHost :: HostName -> Bool +isIAHost h = ".archive.org" `isSuffixOf` map toLower h |