mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-29 05:11:33 +03:00
0df4a235af
The web app's journal state is now kept in the yesod App as an IORef, instead of using io-storage. yesod devel now works; it uses the journal file specified by $LEDGER_FILE, or ~/.hledger.journal. web: update journal state handling, fix yesod devel - WIP
28 lines
724 B
Haskell
28 lines
724 B
Haskell
{-# LANGUAGE PackageImports #-}
|
|
import "hledger-web" Application (getApplicationDev)
|
|
import Network.Wai.Handler.Warp
|
|
(runSettings, defaultSettings, settingsPort)
|
|
import Control.Concurrent (forkIO)
|
|
import System.Directory (doesFileExist, removeFile)
|
|
import System.Exit (exitSuccess)
|
|
import Control.Concurrent (threadDelay)
|
|
|
|
main :: IO ()
|
|
main = do
|
|
putStrLn "Starting devel application"
|
|
(port, app) <- getApplicationDev
|
|
forkIO $
|
|
runSettings defaultSettings
|
|
{ settingsPort = port
|
|
} app
|
|
loop
|
|
|
|
loop :: IO ()
|
|
loop = do
|
|
threadDelay 100000
|
|
e <- doesFileExist "yesod-devel/devel-terminate"
|
|
if e then terminateDevel else loop
|
|
|
|
terminateDevel :: IO ()
|
|
terminateDevel = exitSuccess
|