aboutsummaryrefslogtreecommitdiff
path: root/hsm-command/Main.hs
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-12-29 17:05:34 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-01-16 18:30:09 -0800
commitcc639b06c7126fac7b445d8f778455620d7f8f50 (patch)
treea4c5c7c0b0a9cdb5bea0891e198003035065e57d /hsm-command/Main.hs
Initial
Diffstat (limited to 'hsm-command/Main.hs')
-rw-r--r--hsm-command/Main.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/hsm-command/Main.hs b/hsm-command/Main.hs
new file mode 100644
index 0000000..0b24719
--- /dev/null
+++ b/hsm-command/Main.hs
@@ -0,0 +1,33 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell #-}
+
+import Data.Function ((&))
+import Data.Text (Text)
+import Effectful (runEff)
+import Effectful.Log (runLog)
+import Effectful.Reader.Static (runReader)
+import Effectful.Resource (runResource)
+import Hsm.Command.Command (commandStream)
+import Hsm.Command.Readline (runReadline)
+import Hsm.Core.App (launch)
+import Hsm.Core.Env (deriveFromYaml)
+import Hsm.Core.Zmq.Server (runServer, send)
+
+data Env = Env
+ { name :: Text
+ , pubEp :: Text
+ }
+
+$(deriveFromYaml ''Env)
+
+main :: IO ()
+main =
+ launch @Env "command" id $ \env logger level ->
+ (commandStream & send @Env)
+ & runServer @Env
+ & runLog env.name logger level
+ & runReader env
+ & runReadline
+ & runResource
+ & runEff