diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-11 14:06:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-11 14:07:56 -0400 |
commit | 066a06606aeb7f4a3cd70e7b592fef8dc6a9b71e (patch) | |
tree | 98458711a7dab3e3c669b513ed7b84cc2502374b /Remote/WebDAV.hs | |
parent | f779747a0d4d5c9e39a3c82498fe1809d56b4d25 (diff) |
plumb creds from webapp to initremote
Avoids abusing setting environment variables, which was always a hack
and won't work on windows.
Diffstat (limited to 'Remote/WebDAV.hs')
-rw-r--r-- | Remote/WebDAV.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index 7243e359d..6ce83470b 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -1,13 +1,13 @@ {- WebDAV remotes. - - - Copyright 2012 Joey Hess <joey@kitenet.net> + - Copyright 2012-2014 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} {-# LANGUAGE ScopedTypeVariables, CPP #-} -module Remote.WebDAV (remote, davCreds, setCredsEnv, configUrl) where +module Remote.WebDAV (remote, davCreds, configUrl) where import Network.Protocol.HTTP.DAV import qualified Data.Map as M @@ -76,8 +76,8 @@ gen r u c gc = new <$> remoteCost gc expensiveRemoteCost remotetype = remote } -webdavSetup :: Maybe UUID -> RemoteConfig -> Annex (RemoteConfig, UUID) -webdavSetup mu c = do +webdavSetup :: Maybe UUID -> Maybe CredPair -> RemoteConfig -> Annex (RemoteConfig, UUID) +webdavSetup mu mcreds c = do u <- maybe (liftIO genUUID) return mu let url = fromMaybe (error "Specify url=") $ M.lookup "url" c @@ -85,7 +85,7 @@ webdavSetup mu c = do creds <- getCreds c' u testDav url creds gitConfigSpecialRemote u c' "webdav" "true" - c'' <- setRemoteCredPair c' (davCreds u) + c'' <- setRemoteCredPair c' (davCreds u) mcreds return (c'', u) store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool @@ -354,6 +354,3 @@ davCreds u = CredPairStorage , credPairEnvironment = ("WEBDAV_USERNAME", "WEBDAV_PASSWORD") , credPairRemoteKey = Just "davcreds" } - -setCredsEnv :: (String, String) -> IO () -setCredsEnv creds = setEnvCredPair creds $ davCreds undefined |