diff options
| author | LLLL Colonq <llll@colonq> | 2024-11-07 22:51:56 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-11-07 22:51:56 -0500 |
| commit | 309bdcc15db562633ff73da4021f0020f1c0cf6d (patch) | |
| tree | e465b2035d0bed8c53960322ff041122299cbd2f /fig-web/main | |
| parent | 624f7ba8b2fcda6675951dd8d41dcc99017484cf (diff) | |
Secured API
Diffstat (limited to 'fig-web/main')
| -rw-r--r-- | fig-web/main/Main.hs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/fig-web/main/Main.hs b/fig-web/main/Main.hs index 890c010..926685c 100644 --- a/fig-web/main/Main.hs +++ b/fig-web/main/Main.hs @@ -6,13 +6,25 @@ import Fig.Prelude import Options.Applicative -import Fig.Web import Fig.Web.Utils +import qualified Fig.Web as Public +import qualified Fig.Web.Secure as Secure + +data Command + = Public + | Secure + +parseCommand :: Parser Command +parseCommand = subparser $ mconcat + [ command "public" $ info (pure Public) (progDesc "Launch the public web server") + , command "secure" $ info (pure Secure) (progDesc "Launch the private web server (intended to be run behind authentication proxy)") + ] data Opts = Opts - { busHost :: Text - , busPort :: Text - , config :: FilePath + { busHost :: !Text + , busPort :: !Text + , config :: !FilePath + , command :: !Command } parseOpts :: Parser Opts @@ -20,6 +32,7 @@ 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") + command <- parseCommand pure Opts{..} main :: IO () @@ -29,4 +42,6 @@ main = do <> header "fig-web - public-facing web applications" ) cfg <- loadConfig opts.config - server cfg (opts.busHost, opts.busPort) + case cfg.command of + Public -> Public.server cfg (opts.busHost, opts.busPort) + Secure -> Secure.server cfg (opts.busHost, opts.busPort) |
