1
1
mirror of https://github.com/github/semantic.git synced 2024-12-28 09:21:35 +03:00

Just one defaultConfig

This commit is contained in:
Timothy Clem 2018-06-15 10:17:02 -07:00
parent 033a748ed7
commit 21e3f69110
3 changed files with 4 additions and 7 deletions

View File

@ -48,11 +48,8 @@ data StatsAddr = StatsAddr { addrHost :: Stat.Host, addrPort :: Stat.Port }
defaultOptions :: Options
defaultOptions = Options (Just Warning) Nothing False
defaultConfig :: IO Config
defaultConfig = defaultConfig' defaultOptions
defaultConfig' :: Options -> IO Config
defaultConfig' options@Options{..} = do
defaultConfig :: Options -> IO Config
defaultConfig options@Options{..} = do
pid <- getProcessID
hostName <- getHostName
isTerminal <- hIsTerminalDevice stderr

View File

@ -128,7 +128,7 @@ runTask = runTaskWithOptions defaultOptions
-- | Execute a 'TaskEff' with the passed 'Options', yielding its result value in 'IO'.
runTaskWithOptions :: Options -> TaskEff a -> IO a
runTaskWithOptions opts task = do
config <- defaultConfig' opts
config <- defaultConfig opts
result <- withTelemetry config $ \(TelemetryQueues logger statter _) ->
runTaskWithConfig config logger statter task
either (die . displayException) pure result

View File

@ -84,4 +84,4 @@ spec = do
-- Defaults are all driven by defaultConfig.
defaultStatsClient :: IO StatsClient
defaultStatsClient = defaultConfig >>= \Config{..} -> statsClient (addrHost configStatsAddr) (addrPort configStatsAddr) configAppName
defaultStatsClient = defaultConfig defaultOptions >>= \Config{..} -> statsClient (addrHost configStatsAddr) (addrPort configStatsAddr) configAppName