summaryrefslogtreecommitdiff
path: root/fig-monitor-bullfrog/main/Main.hs
blob: 966e0a1274c5bd2e6f48aaa4642cc3976b9465bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Main where

import Fig.Prelude

import Options.Applicative

import Fig.Monitor.Bullfrog
import Fig.Monitor.Bullfrog.Utils

data Opts = Opts
  { busHost :: Text
  , busPort :: Text
  , config :: FilePath
  }

parseOpts :: Parser Opts
parseOpts = Opts
  <$> strOption (long "bus-host" <> metavar "HOST" <> help "Address of message bus" <> value "localhost")
  <*> strOption (long "bus-port" <> metavar "PORT" <> help "Message bus port" <> showDefault <> value "32050")
  <*> strOption (long "config" <> metavar "PATH" <> help "Path to config file" <> showDefault <> value "fig-monitor-bullfrog.toml")

main :: IO ()
main = do
  opts <- execParser $ info (parseOpts <**> helper)
    ( fullDesc
    <> header "fig-monitor-bullfrog - monitor Bullfrog broadcast server"
    )
  cfg <- loadConfig opts.config
  bullfrogClient cfg (opts.busHost, opts.busPort)