mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-24 16:03:37 +03:00
c437a42f6d
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8159 Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com> Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com> GitOrigin-RevId: a57f6dc8b3e992d86490e5c51508827f00151dfe
21 lines
876 B
Haskell
21 lines
876 B
Haskell
module Network.HTTP.Client.CreateManager
|
|
( mkHttpManager,
|
|
)
|
|
where
|
|
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.Types.Network (TlsAllow)
|
|
import Network.HTTP.Client qualified as HTTP
|
|
import Network.HTTP.Client.Blocklisting (Blocklist, block)
|
|
import Network.HTTP.Client.DynamicTlsPermissions qualified as HTTP
|
|
import Network.HTTP.Client.Restricted qualified as Restricted
|
|
|
|
-- | This mkHttpManager function takes a mechanism for finding the current allowlist,
|
|
-- | Thus allowing it to be coupled from any ref type such as AppStateRef.
|
|
-- | A mechanism to block IPs (both IPv4 and IPv6) has also been added to it.
|
|
mkHttpManager :: IO [TlsAllow] -> Blocklist -> IO HTTP.Manager
|
|
mkHttpManager currentAllow blocklist = do
|
|
tlsSettings <- HTTP.dynamicTlsSettings currentAllow
|
|
HTTP.newManager $
|
|
Restricted.mkRestrictedManagerSettings (block blocklist) Nothing (Just tlsSettings)
|