This repository has been archived on 2022-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
simplexmq/apps/smp-agent/Main.hs

34 lines
984 B
Haskell
Raw Normal View History

{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
2020-12-25 16:46:02 +00:00
module Main where
import Control.Logger.Simple
import qualified Data.List.NonEmpty as L
2020-12-26 13:01:57 +00:00
import Simplex.Messaging.Agent.Env.SQLite
import Simplex.Messaging.Agent.Server (runSMPAgent)
import Simplex.Messaging.Client (defaultNetworkConfig)
import Simplex.Messaging.Transport (TLS, Transport (..))
2020-12-25 16:46:02 +00:00
cfg :: AgentConfig
cfg = defaultAgentConfig
servers :: InitialAgentServers
servers =
InitialAgentServers
{ smp = L.fromList ["smp://bU0K-bRg24xWW__lS0umO1Zdw_SXqpJNtm1_RrPLViE=@localhost:5223"],
ntf = [],
netCfg = defaultNetworkConfig
}
2020-12-25 16:46:02 +00:00
logCfg :: LogConfig
logCfg = LogConfig {lc_file = Nothing, lc_stderr = True}
2020-12-25 16:46:02 +00:00
main :: IO ()
main = do
putStrLn $ "SMP agent listening on port " ++ tcpPort (cfg :: AgentConfig)
setLogLevel LogInfo -- LogError
withGlobalLogging logCfg $ runSMPAgent (transport @TLS) cfg servers