aboutsummaryrefslogtreecommitdiff
path: root/Command/WebApp.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-01 00:31:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-01 00:31:17 -0400
commit518e5430afd0f85b1b6c334b887df24e3fbd8933 (patch)
tree75979e10ac21973596f7c28abbabdc5b7dbdf1fc /Command/WebApp.hs
parent4026f786267b990e81b9768a46a410a90488eb76 (diff)
annex.listen can be configured, instead of using --listen
Diffstat (limited to 'Command/WebApp.hs')
-rw-r--r--Command/WebApp.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index b252d4d7c..ee5998c9a 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -68,18 +68,24 @@ start' allowauto listenhost = do
cannotrun <- needsUpgrade . fromMaybe (error "no version") =<< getVersion
browser <- fromRepo webBrowser
f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim
+ listenhost' <- if isJust listenhost
+ then pure listenhost
+ else annexListen <$> Annex.getGitConfig
ifM (checkpid <&&> checkshim f)
( if isJust listenhost
then error "The assistant is already running, so --listen cannot be used."
else do
url <- liftIO . readFile
=<< fromRepo gitAnnexUrlFile
- liftIO $ openBrowser browser f url Nothing Nothing
- , startDaemon True True Nothing cannotrun listenhost $ Just $
- \origout origerr url htmlshim ->
- if isJust listenhost
- then maybe noop (`hPutStrLn` url) origout
- else openBrowser browser htmlshim url origout origerr
+ liftIO $ if isJust listenhost'
+ then putStrLn url
+ else liftIO $ openBrowser browser f url Nothing Nothing
+ , do
+ startDaemon True True Nothing cannotrun listenhost' $ Just $
+ \origout origerr url htmlshim ->
+ if isJust listenhost'
+ then maybe noop (`hPutStrLn` url) origout
+ else openBrowser browser htmlshim url origout origerr
)
auto
| allowauto = liftIO $ startNoRepo []
@@ -142,8 +148,9 @@ firstRun listenhost = do
let callback a = Just $ a v
runAssistant d $ do
startNamedThread urlrenderer $
- webAppThread d urlrenderer True Nothing listenhost
+ webAppThread d urlrenderer True Nothing
(callback signaler)
+ listenhost
(callback mainthread)
waitNamedThreads
where