44 lines
1.1 KiB
Haskell
44 lines
1.1 KiB
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Main where
|
|
|
|
import Control.Concurrent (forkIO, threadDelay)
|
|
import Control.Monad
|
|
import Control.Monad.IO.Class
|
|
import Data.Aeson
|
|
import qualified Data.ByteString as B
|
|
import Data.SecureMem
|
|
import qualified Data.Text as T
|
|
import qualified Data.Text.Lazy as L
|
|
import Database.MongoDB
|
|
import GHC.Generics
|
|
import Network.HTTP.Simple
|
|
import Network.HTTP.Types.Status
|
|
import Network.Wai.Middleware.HttpAuth
|
|
import Web.Scotty
|
|
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
|