-- | Override a specific 'ServiceConfig'. All requests belonging to the
-- supplied service will use this configuration instead of the default.
--
-- Typically you would override a modified version of the default 'ServiceConfig'
-- for the desired service:
--
-- > override (gmailService & serviceHost .~ "localhost") env
--
-- Or when using "Network.Google" with "Control.Monad.Reader" or "Control.Lens.Zoom"
-- and the 'ServiceConfig' lenses:
--
-- > local (override (computeService & serviceHost .~ "localhost")) $ do
-- >    ...
--
-- /See:/ 'configure'.
override :: HasEnv s a => ServiceConfig -> a -> a
override s = configure f
  where
    f x | on (==) _svcId s x = s
        | otherwise          = x

-- | Scope an action such that any HTTP response will use this timeout value.
--
-- Default timeouts are chosen by considering:
--
-- * This 'timeout', if set.
--
-- * The related 'Service' timeout for the sent request if set. (Default 70s)
--
-- * The 'envManager' timeout, if set.
--
-- * The 'ClientRequest' timeout. (Default 30s)
override :: HasEnv s a => ServiceConfig -> a -> a
override s = configure f
  where
    f x | on (==) _svcId s x = s
        | otherwise          = x

-- | Scope an action such that any HTTP response will use this timeout value.
--
-- Default timeouts are chosen by considering:
--
-- * This 'timeout', if set.
--
-- * The related 'Service' timeout for the sent request if set. (Default 70s)
--
-- * The 'envManager' timeout, if set.
--
-- * The 'ClientRequest' timeout. (Default 30s)
override s = configure f
  where
    f x | on (==) _svcId s x = s
        | otherwise          = x

-- | Scope an action such that any HTTP response will use this timeout value.
--
-- Default timeouts are chosen by considering:
--
-- * This 'timeout', if set.
--
-- * The related 'Service' timeout for the sent request if set. (Default 70s)
--
-- * The 'envManager' timeout, if set.
--
-- * The 'ClientRequest' timeout. (Default 30s)