diff options
Diffstat (limited to 'src/Conf.hs')
-rw-r--r-- | src/Conf.hs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/Conf.hs b/src/Conf.hs deleted file mode 100644 index 03f8dc2..0000000 --- a/src/Conf.hs +++ /dev/null @@ -1,37 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Conf - ( parse - , Conf(..) - ) where - -import Data.Text (Text) -import qualified Data.Text as T -import qualified Data.ConfigManager as Conf -import Data.Time.Clock (NominalDiffTime) - -import Model.URL - -data Conf = Conf - { urls :: [URL] - , mailFrom :: Text - , mailTo :: [Text] - , properties :: [Text] - , listenInterval :: NominalDiffTime - } deriving Show - -parse :: FilePath -> IO Conf -parse path = do - conf <- - (flip fmap) (Conf.readConfig path) (\configOrError -> do - conf <- configOrError - Conf <$> - Conf.lookup "urls" conf <*> - Conf.lookup "mailFrom" conf <*> - Conf.lookup "mailTo" conf <*> - Conf.lookup "properties" conf <*> - Conf.lookup "listenInterval" conf - ) - case conf of - Left msg -> error (T.unpack msg) - Right c -> return c |