diff options
author | Joris | 2019-09-05 20:46:36 +0200 |
---|---|---|
committer | Joris | 2019-09-05 20:46:36 +0200 |
commit | 317e7b1e7319182e5caa5169119aea9fc8d660b6 (patch) | |
tree | dc9f9c458c42d1e2c60a12ff55267e042c88f6ba /src/executable/haskell/Conf.hs | |
parent | 223ae6aa0b14c071d5719ada0cc6b43e9199a81b (diff) |
Enable the listener only during some hours
Diffstat (limited to 'src/executable/haskell/Conf.hs')
-rw-r--r-- | src/executable/haskell/Conf.hs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/executable/haskell/Conf.hs b/src/executable/haskell/Conf.hs index df26ea0..0dc857b 100644 --- a/src/executable/haskell/Conf.hs +++ b/src/executable/haskell/Conf.hs @@ -6,18 +6,21 @@ module Conf import qualified Data.ConfigManager as Conf import Data.Text (Text) import qualified Data.Text as T -import Data.Time.Clock (NominalDiffTime) +import Data.Time.Clock (DiffTime) import Model.URL data Conf = Conf - { leboncoinUrls :: [URL] - , ouestFranceUrls :: [URL] - , seLogerUrls :: [URL] - , mailFrom :: Text - , mailTo :: [Text] - , mailMock :: Bool - , listenInterval :: NominalDiffTime + { leboncoinUrls :: [URL] + , ouestFranceUrls :: [URL] + , seLogerUrls :: [URL] + , mailFrom :: Text + , mailTo :: [Text] + , mailMock :: Bool + , listenFrom :: DiffTime + , listenTo :: DiffTime + , listenInterval :: DiffTime + , listenIntervalNoise :: DiffTime } deriving Show parse :: FilePath -> IO Conf @@ -32,7 +35,10 @@ parse path = do Conf.lookup "mailFrom" conf <*> Conf.lookup "mailTo" conf <*> Conf.lookup "mailMock" conf <*> - Conf.lookup "listenInterval" conf + Conf.lookup "listenFrom" conf <*> + Conf.lookup "listenTo" conf <*> + Conf.lookup "listenInterval" conf <*> + Conf.lookup "listenIntervalNoise" conf ) case conf of Left msg -> error (T.unpack msg) |