webapp: New preferences page allows enabling/disabling debug logging at runtime, as well as configuring numcopies and diskreserve.

This commit is contained in:
Joey Hess 2013-03-03 17:07:27 -04:00
parent d7ad02f893
commit 08bdea7e52
13 changed files with 174 additions and 58 deletions

View file

@ -50,21 +50,17 @@ checkAutoStart = ifM (elem "--autostart" <$> getArgs)
autoStart :: IO ()
autoStart = do
autostartfile <- autoStartFile
let nothing = error $ "Nothing listed in " ++ autostartfile
ifM (doesFileExist autostartfile)
( do
dirs <- nub . lines <$> readFile autostartfile
program <- readProgramFile
when (null dirs) nothing
forM_ dirs $ \d -> do
putStrLn $ "git-annex autostart in " ++ d
ifM (catchBoolIO $ go program d)
( putStrLn "ok"
, putStrLn "failed"
)
, nothing
)
dirs <- liftIO readAutoStartFile
when (null dirs) $ do
f <- autoStartFile
error $ "Nothing listed in " ++ f
program <- readProgramFile
forM_ dirs $ \d -> do
putStrLn $ "git-annex autostart in " ++ d
ifM (catchBoolIO $ go program d)
( putStrLn "ok"
, putStrLn "failed"
)
where
go program dir = do
changeWorkingDirectory dir

View file

@ -64,20 +64,13 @@ start' allowauto = do
liftIO $ isJust <$> checkDaemon pidfile
checkshim f = liftIO $ doesFileExist f
{- When run without a repo, see if there is an autoStartFile,
- and if so, start the first available listed repository.
- If not, it's our first time being run! -}
{- When run without a repo, start the first available listed repository in
- the autostart file. If not, it's our first time being run! -}
startNoRepo :: IO ()
startNoRepo = do
autostartfile <- autoStartFile
ifM (doesFileExist autostartfile) ( autoStart autostartfile , firstRun )
autoStart :: FilePath -> IO ()
autoStart autostartfile = do
dirs <- nub . lines <$> readFile autostartfile
edirs <- filterM doesDirectoryExist dirs
case edirs of
[] -> firstRun -- what else can I do? Nothing works..
dirs <- liftIO $ filterM doesDirectoryExist =<< readAutoStartFile
case dirs of
[] -> firstRun
(d:_) -> do
changeWorkingDirectory d
state <- Annex.new =<< Git.CurrentRepo.get