{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Boots.Factory.Endpoint(
buildEndpoints
, registerEndpoint
, endpointInfo
, endpointLogger
, endpointRefresh
, endpointHealth
, endpointMetrics
) where
import Boots
import Boots.Endpoint.Class
import Boots.Endpoint.Health
import Boots.Endpoint.Info
import Boots.Endpoint.Logger
import Boots.Endpoint.Metrics
import Boots.Endpoint.Refresh
import Boots.Factory.Web
buildEndpoints
:: forall context env n
. (HasWeb context env, MonadMask n, MonadIO n)
=> Proxy context
-> Proxy env
-> Factory n (WebEnv env context) ()
buildEndpoints pc _ = do
WebEnv{..} <- getEnv
unless (enabled endpoint) $ logInfo "Endpoint is disabled."
when (enabled endpoint) $ do
endpointInfo pc
endpointLogger pc
endpointRefresh pc
endpointHealth pc
endpointMetrics pc