webapp: When setting up a ssh remote, record it using initremote, so that it can be easily enabled elsewhere.

This is the capstone in making the webapp remember ssh remotes
so they can be easily enabled in other clones of the repository.

Currently, the user will need to enter a password to enable the ssh remote,
but everything else is filled in automatically.

This commit was sponsored by Peter Lloyd.
This commit is contained in:
Joey Hess 2014-05-22 14:53:00 -04:00
parent c11461b860
commit 2e1179df46
4 changed files with 41 additions and 14 deletions

View file

@ -31,13 +31,13 @@ import Utility.Yesod
- This includes displaying the connectionNeeded nudge if appropariate.
-}
setupCloudRemote :: StandardGroup -> Maybe Cost -> Annex RemoteName -> Handler a
setupCloudRemote = setupRemote $ redirect . EditNewCloudRepositoryR
setupCloudRemote = setupRemote $ redirect . EditNewCloudRepositoryR . Remote.uuid
setupRemote :: (UUID -> Handler a) -> StandardGroup -> Maybe Cost -> Annex RemoteName -> Handler a
setupRemote :: (Remote -> Handler a) -> StandardGroup -> Maybe Cost -> Annex RemoteName -> Handler a
setupRemote postsetup defaultgroup mcost getname = do
r <- liftAnnex $ addRemote getname
liftAnnex $ do
setStandardGroup (Remote.uuid r) defaultgroup
maybe noop (Config.setRemoteCost (Remote.repo r)) mcost
liftAssistant $ syncRemote r
postsetup $ Remote.uuid r
postsetup r