zgo-backend/app/Main.hs

34 lines
809 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent (forkIO, threadDelay)
import Data.SecureMem
import qualified Data.Text as T
import Database.MongoDB
import ZGoBackend
passkey :: SecureMem
passkey = secureMemFromByteString "superSecret"
nodeAddress :: T.Text
nodeAddress =
"zs1xnpqd2tae9d95f8fhe4l0q7j44a5vf993m0pcnnvr56uqr4lgqlamesk5v4c5rhtvywc6lvlduy"
dbUser :: T.Text
dbUser = "zgo"
dbPassword :: T.Text
dbPassword = "zcashrules"
main :: IO ()
main = do
putStrLn "Starting Server..."
pipe <- connect $ host "127.0.0.1"
j <- access pipe master "zgo" (auth dbUser dbPassword)
{-_ <- forkIO (setInterval 60 (checkZcashPrices pipe))-}
if j
then putStrLn "Connected to MongoDB!"
else fail "MongoDB connection failed!"
app pipe "zgo" passkey nodeAddress