summaryrefslogtreecommitdiff
path: root/fig-web/main/Main.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-11-07 22:37:32 -0500
committerLLLL Colonq <llll@colonq>2024-11-07 22:37:32 -0500
commit624f7ba8b2fcda6675951dd8d41dcc99017484cf (patch)
treeff1bcc3ee77c73e73c3e246bc8e18ce8f3aca004 /fig-web/main/Main.hs
parentbb3f54c297f480db32303e9ee78fb72c5418b77a (diff)
Rename fig-frontend to fig-web
(It was the backend anyway :3)
Diffstat (limited to 'fig-web/main/Main.hs')
-rw-r--r--fig-web/main/Main.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/fig-web/main/Main.hs b/fig-web/main/Main.hs
new file mode 100644
index 0000000..890c010
--- /dev/null
+++ b/fig-web/main/Main.hs
@@ -0,0 +1,32 @@
+{-# Language ApplicativeDo #-}
+
+module Main where
+
+import Fig.Prelude
+
+import Options.Applicative
+
+import Fig.Web
+import Fig.Web.Utils
+
+data Opts = Opts
+ { busHost :: Text
+ , busPort :: Text
+ , config :: FilePath
+ }
+
+parseOpts :: Parser Opts
+parseOpts = do
+ busHost <- strOption (long "bus-host" <> metavar "HOST" <> help "Address of message bus" <> value "localhost")
+ busPort <- strOption (long "bus-port" <> metavar "PORT" <> help "Message bus port" <> showDefault <> value "32050")
+ config <- strOption (long "config" <> metavar "PATH" <> help "Path to config file" <> showDefault <> value "fig-web.toml")
+ pure Opts{..}
+
+main :: IO ()
+main = do
+ opts <- execParser $ info (parseOpts <**> helper)
+ ( fullDesc
+ <> header "fig-web - public-facing web applications"
+ )
+ cfg <- loadConfig opts.config
+ server cfg (opts.busHost, opts.busPort)