From a3b1c322a243bf6f9a603771a4db253474424608 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 25 Apr 2013 13:14:49 -0400 Subject: support enabling IA repositories --- Remote/S3.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Remote') 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 -- cgit v1.2.3