33 lines
858 B
Haskell
33 lines
858 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Tasks where
|
|
|
|
import Config
|
|
import Database.MongoDB
|
|
import ZGoBackend
|
|
|
|
main :: IO ()
|
|
main = do
|
|
putStrLn "ZGo Recurring Tasks"
|
|
putStrLn "Reading config..."
|
|
loadedConfig <- loadZGoConfig "zgo.cfg"
|
|
pipe <- connect $ host (c_dbHost loadedConfig)
|
|
j <-
|
|
access
|
|
pipe
|
|
master
|
|
(c_dbName loadedConfig)
|
|
(auth (c_dbUser loadedConfig) (c_dbPassword loadedConfig))
|
|
if j
|
|
then do
|
|
putStrLn "Connected to MongoDB!"
|
|
checkZcashPrices pipe (c_dbName loadedConfig)
|
|
scanZcash' loadedConfig pipe
|
|
scanPayments loadedConfig pipe
|
|
checkPayments pipe (c_dbName loadedConfig)
|
|
expireOwners pipe (c_dbName loadedConfig)
|
|
updateLogins pipe loadedConfig
|
|
expireProSessions pipe (c_dbName loadedConfig)
|
|
close pipe
|
|
else fail "MongoDB connection failed!"
|