aboutsummaryrefslogtreecommitdiff
path: root/src/Sproxy
diff options
context:
space:
mode:
Diffstat (limited to 'src/Sproxy')
-rw-r--r--src/Sproxy/Config.hs4
-rw-r--r--src/Sproxy/Server.hs3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Sproxy/Config.hs b/src/Sproxy/Config.hs
index f1d8004..cb32a06 100644
--- a/src/Sproxy/Config.hs
+++ b/src/Sproxy/Config.hs
@@ -65,6 +65,7 @@ data BackendConf = BackendConf
, beCookieDomain :: Maybe String
, beCookieMaxAge :: Int64
, beConnCount :: Int
+ , beTimeout :: Int
} deriving (Show)
instance FromJSON BackendConf where
@@ -75,7 +76,8 @@ instance FromJSON BackendConf where
m .:? "cookie_name" .!= "sproxy" <*>
m .:? "cookie_domain" <*>
m .:? "cookie_max_age" .!= (7 * 24 * 60 * 60) <*>
- m .:? "conn_count" .!= 32
+ m .:? "conn_count" .!= 32 <*>
+ m .:? "timeout" .!= 30
parseJSON _ = empty
data OAuth2Conf = OAuth2Conf
diff --git a/src/Sproxy/Server.hs b/src/Sproxy/Server.hs
index 75a50a4..2477364 100644
--- a/src/Sproxy/Server.hs
+++ b/src/Sproxy/Server.hs
@@ -13,7 +13,7 @@ import Data.Word (Word16)
import Data.Yaml.Include (decodeFileEither)
import Network.HTTP.Client
(Manager, ManagerSettings(..), defaultManagerSettings, newManager,
- socketConnection)
+ responseTimeoutMicro, socketConnection)
import Network.HTTP.Client.Internal (Connection)
import Network.Socket
(Family(AF_INET, AF_UNIX), SockAddr(SockAddrInet, SockAddrUnix),
@@ -152,6 +152,7 @@ newBackendManager be = do
defaultManagerSettings
{ managerRawConnection = return $ \_ _ _ -> openConn
, managerConnCount = beConnCount be
+ , managerResponseTimeout = responseTimeoutMicro (1000000 * beTimeout be)
}
newServer :: ConfigFile -> IO (Settings -> Socket -> Application -> IO ())