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-24 16:34:27 -0800
commitdd9aa4a851829c792fc034d3169ef7e90ea899b4 (patch)
tree85fb58c9117616f091c34b2193009388ff39bb7a /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