From 86a96decdb8892b10c5314eb916ef15a64204450 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 13 Nov 2016 00:49:32 +0100 Subject: Send weekly activity at start of week about previous week --- src/server/Conf.hs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/server/Conf.hs') diff --git a/src/server/Conf.hs b/src/server/Conf.hs index 13d5981..a05349d 100644 --- a/src/server/Conf.hs +++ b/src/server/Conf.hs @@ -1,11 +1,12 @@ {-# LANGUAGE OverloadedStrings #-} module Conf - ( getConf + ( get , Conf(..) ) where import Data.Text (Text) +import qualified Data.Text as T import qualified Data.ConfigManager as Conf import Data.Time.Clock (NominalDiffTime) @@ -18,15 +19,19 @@ data Conf = Conf , https :: Bool } deriving Show -getConf :: FilePath -> IO (Either Text Conf) -getConf path = - (flip fmap) (Conf.readConfig path) (\configOrError -> do - conf <- configOrError - Conf <$> - Conf.lookup "hostname" conf <*> - Conf.lookup "port" conf <*> - Conf.lookup "signInExpiration" conf <*> - Conf.lookup "currency" conf <*> - Conf.lookup "noReplyMail" conf <*> - Conf.lookup "https" conf - ) +get :: FilePath -> IO Conf +get path = do + conf <- + (flip fmap) (Conf.readConfig path) (\configOrError -> do + conf <- configOrError + Conf <$> + Conf.lookup "hostname" conf <*> + Conf.lookup "port" conf <*> + Conf.lookup "signInExpiration" conf <*> + Conf.lookup "currency" conf <*> + Conf.lookup "noReplyMail" conf <*> + Conf.lookup "https" conf + ) + case conf of + Left msg -> error (T.unpack msg) + Right c -> return c -- cgit v1.2.3