Add Yore.Config
This commit is contained in:
@@ -31,6 +31,7 @@ import Servant
|
||||
, (:>)
|
||||
, pattern MkHandler
|
||||
)
|
||||
import System.Exit (exitWith, ExitCode (..))
|
||||
import System.FilePath ((</>))
|
||||
import Text.Blaze.Html.Renderer.Utf8 (renderHtml)
|
||||
import Text.Blaze.Html5 ((!))
|
||||
@@ -50,11 +51,18 @@ import Yore.DB (DayFile (..))
|
||||
import Yore.Error (Error (..))
|
||||
import Yore.Time (addYears, getCurrentDay, getSecondsUntilMidnight)
|
||||
|
||||
import qualified Yore.Config as Config
|
||||
import qualified Yore.DB as DB
|
||||
import qualified Yore.Log as Log
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
cfg <- Config.load @Config.Config >>= \case
|
||||
Left err -> do
|
||||
Log.error err
|
||||
exitWith $ ExitFailure 1
|
||||
Right cfg ->
|
||||
pure cfg
|
||||
db <- DB.initDB "host=localhost user=yore-test port=5433 dbname=yore-test"
|
||||
Warp.runSettings settings $ serve (Proxy :: Proxy API) $ hoistServer (Proxy :: Proxy API) nt $ server db
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user