diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-28 13:31:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-28 13:31:49 -0400 |
commit | 1f8b494ed848db69dfdb2de528d1f9290131140b (patch) | |
tree | 9920ba3f17a740eb367b34548a38471994b728d0 /Creds.hs | |
parent | 04f27132314744ad743cda697761b510b1cb17e8 (diff) |
webapp: Defaults to sharing box.com account info with friends, allowing one-click enabling of the repository.
Diffstat (limited to 'Creds.hs')
-rw-r--r-- | Creds.hs | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -34,7 +34,7 @@ data CredPairStorage = CredPairStorage {- Stores creds in a remote's configuration, if the remote allows - that. Otherwise, caches them locally. -} setRemoteCredPair :: RemoteConfig -> CredPairStorage -> Annex RemoteConfig -setRemoteCredPair c storage = go =<< getRemoteCredPair' c storage +setRemoteCredPair c storage = go =<< getRemoteCredPair c storage where go (Just creds) | embedCreds c = case credPairRemoteKey storage of @@ -58,8 +58,8 @@ setRemoteCredPair c storage = go =<< getRemoteCredPair' c storage {- Gets a remote's credpair, from the environment if set, otherwise - from the cache in gitAnnexCredsDir, or failing that, from the - value in RemoteConfig. -} -getRemoteCredPair :: String -> RemoteConfig -> CredPairStorage -> Annex (Maybe CredPair) -getRemoteCredPair this c storage = maybe missing (return . Just) =<< getRemoteCredPair' c storage +getRemoteCredPairFor :: String -> RemoteConfig -> CredPairStorage -> Annex (Maybe CredPair) +getRemoteCredPairFor this c storage = maybe missing (return . Just) =<< getRemoteCredPair c storage where (loginvar, passwordvar) = credPairEnvironment storage missing = do @@ -70,8 +70,8 @@ getRemoteCredPair this c storage = maybe missing (return . Just) =<< getRemoteCr ] return Nothing -getRemoteCredPair' :: RemoteConfig -> CredPairStorage -> Annex (Maybe CredPair) -getRemoteCredPair' c storage = maybe fromcache (return . Just) =<< fromenv +getRemoteCredPair :: RemoteConfig -> CredPairStorage -> Annex (Maybe CredPair) +getRemoteCredPair c storage = maybe fromcache (return . Just) =<< fromenv where fromenv = liftIO $ getEnvCredPair storage fromcache = maybe fromconfig (return . Just) =<< readCacheCredPair storage @@ -103,8 +103,6 @@ getEnvCredPair storage = liftM2 (,) (uenv, penv) = credPairEnvironment storage get = catchMaybeIO . getEnv - - {- Stores a CredPair in the environment. -} setEnvCredPair :: CredPair -> CredPairStorage -> IO () setEnvCredPair (l, p) storage = do |