mirror of
https://github.com/snoyberg/keter.git
synced 2024-12-14 08:05:40 +03:00
Extended config data types with time bound option
Implemented connection time bound option for both V04 and V10 configurations, default value is set to 5000ms.
This commit is contained in:
parent
107ddf9e5e
commit
f74a95a852
@ -80,6 +80,7 @@ data KeterConfig = KeterConfig
|
||||
, kconfigSetuid :: Maybe Text
|
||||
, kconfigReverseProxy :: Set ReverseProxyConfig
|
||||
, kconfigIpFromHeader :: Bool
|
||||
, kconfigConnectionTimeBound :: Int
|
||||
}
|
||||
|
||||
instance Default KeterConfig where
|
||||
@ -92,6 +93,7 @@ instance Default KeterConfig where
|
||||
, kconfigSetuid = Nothing
|
||||
, kconfigReverseProxy = Set.empty
|
||||
, kconfigIpFromHeader = False
|
||||
, kconfigConnectionTimeBound = 5000
|
||||
}
|
||||
|
||||
instance ParseYamlFile KeterConfig where
|
||||
@ -104,6 +106,7 @@ instance ParseYamlFile KeterConfig where
|
||||
<*> o .:? "setuid"
|
||||
<*> o .:? "reverse-proxy" .!= Set.empty
|
||||
<*> o .:? "ip-from-header" .!= False
|
||||
<*> o .:? "connection-time-bound" .!= 5000
|
||||
|
||||
data TLSConfig = TLSConfig !Warp.Settings !WarpTLS.TLSSettings
|
||||
|
||||
|
@ -99,11 +99,12 @@ data KeterConfig = KeterConfig
|
||||
-- ^ External HTTPS port when generating APPROOTs.
|
||||
, kconfigEnvironment :: !(Map Text Text)
|
||||
-- ^ Environment variables to be passed to all apps.
|
||||
, kconfigConnectionTimeBound :: !Int
|
||||
}
|
||||
|
||||
instance ToCurrent KeterConfig where
|
||||
type Previous KeterConfig = V04.KeterConfig
|
||||
toCurrent (V04.KeterConfig dir portman host port ssl setuid rproxy ipFromHeader) = KeterConfig
|
||||
toCurrent (V04.KeterConfig dir portman host port ssl setuid rproxy ipFromHeader connectionTimeBound) = KeterConfig
|
||||
{ kconfigDir = dir
|
||||
, kconfigPortPool = portman
|
||||
, kconfigListeners = NonEmptyVector (LPInsecure host port) (getSSL ssl)
|
||||
@ -113,6 +114,7 @@ instance ToCurrent KeterConfig where
|
||||
, kconfigExternalHttpPort = 80
|
||||
, kconfigExternalHttpsPort = 443
|
||||
, kconfigEnvironment = Map.empty
|
||||
, kconfigConnectionTimeBound = connectionTimeBound
|
||||
}
|
||||
where
|
||||
getSSL Nothing = V.empty
|
||||
@ -134,6 +136,7 @@ instance Default KeterConfig where
|
||||
, kconfigExternalHttpPort = 80
|
||||
, kconfigExternalHttpsPort = 443
|
||||
, kconfigEnvironment = Map.empty
|
||||
, kconfigConnectionTimeBound = 5000
|
||||
}
|
||||
|
||||
instance ParseYamlFile KeterConfig where
|
||||
@ -153,6 +156,7 @@ instance ParseYamlFile KeterConfig where
|
||||
<*> o .:? "external-http-port" .!= 80
|
||||
<*> o .:? "external-https-port" .!= 443
|
||||
<*> o .:? "env" .!= Map.empty
|
||||
<*> o .:? "connection-time-bound" .!= 5000
|
||||
|
||||
-- | Whether we should force redirect to HTTPS routes.
|
||||
type RequiresSecure = Bool
|
||||
|
@ -32,3 +32,7 @@ listeners:
|
||||
# Set additional environment variables for all apps
|
||||
# env:
|
||||
# key: value
|
||||
|
||||
# Connection time bound in milliseconds, set to 0 to have no time bound,
|
||||
# i.e. keep connections alive indefinitely. Default value is 5000.
|
||||
# connection-time-bound: 5000
|
Loading…
Reference in New Issue
Block a user