mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-26 15:17:24 +00:00
* agent schema/methods/types/store methods for notifications tokens * register notification token on the server * agent commands for notification tokens * refactor initial servers from AgentConfig * agent store functions for notification tokens * server STM store methods for tokens * fix protocol client for ntfs (use generic handshake), minimal server and agent tests * server command to verify ntf token
52 lines
1.8 KiB
Haskell
52 lines
1.8 KiB
Haskell
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
module Main where
|
|
|
|
import Simplex.Messaging.Client.Agent (defaultSMPClientAgentConfig)
|
|
import Simplex.Messaging.Notifications.Server (runNtfServer)
|
|
import Simplex.Messaging.Notifications.Server.Env (NtfServerConfig (..))
|
|
import Simplex.Messaging.Server.CLI (ServerCLIConfig (..), protocolServerCLI)
|
|
import System.FilePath (combine)
|
|
|
|
cfgPath :: FilePath
|
|
cfgPath = "/etc/opt/simplex-notifications"
|
|
|
|
logPath :: FilePath
|
|
logPath = "/var/opt/simplex-notifications"
|
|
|
|
main :: IO ()
|
|
main = protocolServerCLI ntfServerCLIConfig runNtfServer
|
|
|
|
ntfServerCLIConfig :: ServerCLIConfig NtfServerConfig
|
|
ntfServerCLIConfig =
|
|
let caCrtFile = combine cfgPath "ca.crt"
|
|
serverKeyFile = combine cfgPath "server.key"
|
|
serverCrtFile = combine cfgPath "server.crt"
|
|
in ServerCLIConfig
|
|
{ cfgDir = cfgPath,
|
|
logDir = logPath,
|
|
iniFile = combine cfgPath "ntf-server.ini",
|
|
storeLogFile = combine logPath "ntf-server-store.log",
|
|
caKeyFile = combine cfgPath "ca.key",
|
|
caCrtFile,
|
|
serverKeyFile,
|
|
serverCrtFile,
|
|
fingerprintFile = combine cfgPath "fingerprint",
|
|
defaultServerPort = "443",
|
|
executableName = "ntf-server",
|
|
serverVersion = "SMP notifications server v0.1.0",
|
|
mkServerConfig = \_storeLogFile transports ->
|
|
NtfServerConfig
|
|
{ transports,
|
|
subIdBytes = 24,
|
|
regCodeBytes = 32,
|
|
clientQSize = 16,
|
|
subQSize = 64,
|
|
pushQSize = 128,
|
|
smpAgentCfg = defaultSMPClientAgentConfig,
|
|
caCertificateFile = caCrtFile,
|
|
privateKeyFile = serverKeyFile,
|
|
certificateFile = serverCrtFile
|
|
}
|
|
}
|