fix build with S3 disabled (for Android)
This commit is contained in:
parent
2274ec80d7
commit
d9e288b0fd
1 changed files with 9 additions and 1 deletions
|
@ -142,6 +142,7 @@ getAddGlacierR :: Handler RepHtml
|
||||||
getAddGlacierR = postAddGlacierR
|
getAddGlacierR = postAddGlacierR
|
||||||
|
|
||||||
postAddGlacierR :: Handler RepHtml
|
postAddGlacierR :: Handler RepHtml
|
||||||
|
#ifdef WITH_S3
|
||||||
postAddGlacierR = glacierConfigurator $ do
|
postAddGlacierR = glacierConfigurator $ do
|
||||||
defcreds <- liftAnnex previouslyUsedAWSCreds
|
defcreds <- liftAnnex previouslyUsedAWSCreds
|
||||||
((result, form), enctype) <- lift $
|
((result, form), enctype) <- lift $
|
||||||
|
@ -158,6 +159,9 @@ postAddGlacierR = glacierConfigurator $ do
|
||||||
where
|
where
|
||||||
setgroup r = liftAnnex $
|
setgroup r = liftAnnex $
|
||||||
setStandardGroup (Remote.uuid r) SmallArchiveGroup
|
setStandardGroup (Remote.uuid r) SmallArchiveGroup
|
||||||
|
#else
|
||||||
|
postAddGlacierR = error "S3 not supported by this build"
|
||||||
|
#endif
|
||||||
|
|
||||||
getEnableS3R :: UUID -> Handler RepHtml
|
getEnableS3R :: UUID -> Handler RepHtml
|
||||||
#ifdef WITH_S3
|
#ifdef WITH_S3
|
||||||
|
@ -184,6 +188,7 @@ postEnableGlacierR :: UUID -> Handler RepHtml
|
||||||
postEnableGlacierR = glacierConfigurator . enableAWSRemote Glacier.remote
|
postEnableGlacierR = glacierConfigurator . enableAWSRemote Glacier.remote
|
||||||
|
|
||||||
enableAWSRemote :: RemoteType -> UUID -> Widget
|
enableAWSRemote :: RemoteType -> UUID -> Widget
|
||||||
|
#ifdef WITH_S3
|
||||||
enableAWSRemote remotetype uuid = do
|
enableAWSRemote remotetype uuid = do
|
||||||
defcreds <- liftAnnex previouslyUsedAWSCreds
|
defcreds <- liftAnnex previouslyUsedAWSCreds
|
||||||
((result, form), enctype) <- lift $
|
((result, form), enctype) <- lift $
|
||||||
|
@ -198,6 +203,9 @@ enableAWSRemote remotetype uuid = do
|
||||||
description <- liftAnnex $
|
description <- liftAnnex $
|
||||||
T.pack <$> Remote.prettyUUID uuid
|
T.pack <$> Remote.prettyUUID uuid
|
||||||
$(widgetFile "configurators/enableaws")
|
$(widgetFile "configurators/enableaws")
|
||||||
|
#else
|
||||||
|
enableAWSRemote _ _ = error "S3 not supported by this build"
|
||||||
|
#endif
|
||||||
|
|
||||||
makeAWSRemote :: RemoteType -> AWSCreds -> String -> (Remote -> Handler ()) -> RemoteConfig -> Handler ()
|
makeAWSRemote :: RemoteType -> AWSCreds -> String -> (Remote -> Handler ()) -> RemoteConfig -> Handler ()
|
||||||
makeAWSRemote remotetype (AWSCreds ak sk) name setup config = do
|
makeAWSRemote remotetype (AWSCreds ak sk) name setup config = do
|
||||||
|
@ -224,10 +232,10 @@ getRepoInfo c = [whamlet|S3 remote using bucket: #{bucket}|]
|
||||||
#ifdef WITH_S3
|
#ifdef WITH_S3
|
||||||
isIARemoteConfig :: RemoteConfig -> Bool
|
isIARemoteConfig :: RemoteConfig -> Bool
|
||||||
isIARemoteConfig = S3.isIAHost . fromMaybe "" . M.lookup "host"
|
isIARemoteConfig = S3.isIAHost . fromMaybe "" . M.lookup "host"
|
||||||
#endif
|
|
||||||
|
|
||||||
previouslyUsedAWSCreds :: Annex (Maybe CredPair)
|
previouslyUsedAWSCreds :: Annex (Maybe CredPair)
|
||||||
previouslyUsedAWSCreds = getM gettype [S3.remote, Glacier.remote]
|
previouslyUsedAWSCreds = getM gettype [S3.remote, Glacier.remote]
|
||||||
where
|
where
|
||||||
gettype t = previouslyUsedCredPair AWS.creds t $
|
gettype t = previouslyUsedCredPair AWS.creds t $
|
||||||
not . isIARemoteConfig . Remote.config
|
not . isIARemoteConfig . Remote.config
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue