diff options
| author | LLLL Colonq <llll@colonq> | 2025-05-30 02:55:35 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-05-30 02:55:55 -0400 |
| commit | f95d9bbde51ee26468177b2d34c669d9689fbea4 (patch) | |
| tree | 9790f7a39c70e1cc2c6a0d418ace38dcf7a1aa51 /fig-web/main | |
| parent | bab19289fd0b0f7a26056c4f20b5a0f456c9bf57 (diff) | |
web: Big refactor part 2
Diffstat (limited to 'fig-web/main')
| -rw-r--r-- | fig-web/main/Main.hs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fig-web/main/Main.hs b/fig-web/main/Main.hs index 8db47e2..89ac345 100644 --- a/fig-web/main/Main.hs +++ b/fig-web/main/Main.hs @@ -6,18 +6,28 @@ import Fig.Prelude import Options.Applicative +import Fig.Web.Types import Fig.Web.Utils import qualified Fig.Web.Public as Public import qualified Fig.Web.Secure as Secure +parsePublicOptions :: Parser PublicOptions +parsePublicOptions = do + pure PublicOptions{} + +parseSecureOptions :: Parser SecureOptions +parseSecureOptions = do + simAuth <- switch (long "sim-auth" <> help "Simulate authentication instead of actually requiring authentication proxy headers") + pure SecureOptions{..} + data Command - = Public - | Secure + = Public PublicOptions + | Secure SecureOptions 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)") + [ command "public" $ info (Public <$> parsePublicOptions) (progDesc "Launch the public web server") + , command "secure" $ info (Secure <$> parseSecureOptions) (progDesc "Launch the private web server (intended to be run behind authentication proxy)") ] data Opts = Opts @@ -43,5 +53,5 @@ main = do ) cfg <- loadConfig opts.config case opts.cmd of - Public -> Public.server cfg (opts.busHost, opts.busPort) - Secure -> Secure.server cfg (opts.busHost, opts.busPort) + Public o -> Public.server o cfg (opts.busHost, opts.busPort) + Secure o -> Secure.server o cfg (opts.busHost, opts.busPort) |
