Added proxy timeout to yesod devel flags
This commit is contained in:
parent
d483523636
commit
368570efc1
@ -107,13 +107,14 @@ data DevelOpts = DevelOpts
|
|||||||
, failHook :: Maybe String
|
, failHook :: Maybe String
|
||||||
, buildDir :: Maybe String
|
, buildDir :: Maybe String
|
||||||
, develPort :: Int
|
, develPort :: Int
|
||||||
|
, proxyTimeout :: Int
|
||||||
} deriving (Show, Eq)
|
} deriving (Show, Eq)
|
||||||
|
|
||||||
getBuildDir :: DevelOpts -> String
|
getBuildDir :: DevelOpts -> String
|
||||||
getBuildDir opts = fromMaybe "dist" (buildDir opts)
|
getBuildDir opts = fromMaybe "dist" (buildDir opts)
|
||||||
|
|
||||||
defaultDevelOpts :: DevelOpts
|
defaultDevelOpts :: DevelOpts
|
||||||
defaultDevelOpts = DevelOpts False False False (-1) Nothing Nothing Nothing 3000
|
defaultDevelOpts = DevelOpts False False False (-1) Nothing Nothing Nothing 3000 10
|
||||||
|
|
||||||
-- | Run a reverse proxy from port 3000 to 3001. If there is no response on
|
-- | Run a reverse proxy from port 3000 to 3001. If there is no response on
|
||||||
-- 3001, give an appropriate message to the user.
|
-- 3001, give an appropriate message to the user.
|
||||||
@ -127,7 +128,7 @@ reverseProxy opts iappPort = do
|
|||||||
return $ Right $ ProxyDest "127.0.0.1" appPort)
|
return $ Right $ ProxyDest "127.0.0.1" appPort)
|
||||||
def
|
def
|
||||||
{ wpsOnExc = onExc
|
{ wpsOnExc = onExc
|
||||||
, wpsTimeout = Just 10000000
|
, wpsTimeout = Just (1000000 * proxyTimeout opts)
|
||||||
}
|
}
|
||||||
manager
|
manager
|
||||||
putStrLn "Reverse proxy stopped, but it shouldn't"
|
putStrLn "Reverse proxy stopped, but it shouldn't"
|
||||||
|
|||||||
@ -58,6 +58,7 @@ data Command = Init
|
|||||||
, develIgnore :: [String]
|
, develIgnore :: [String]
|
||||||
, develExtraArgs :: [String]
|
, develExtraArgs :: [String]
|
||||||
, _develPort :: Int
|
, _develPort :: Int
|
||||||
|
, _proxyTimeout :: Int
|
||||||
}
|
}
|
||||||
| Test
|
| Test
|
||||||
| AddHandler
|
| AddHandler
|
||||||
@ -95,7 +96,7 @@ main = do
|
|||||||
Configure -> cabal ["configure"]
|
Configure -> cabal ["configure"]
|
||||||
Build es -> touch' >> cabal ("build":es)
|
Build es -> touch' >> cabal ("build":es)
|
||||||
Touch -> touch'
|
Touch -> touch'
|
||||||
Devel da s f r b _ig es p -> devel (DevelOpts (optCabalPgm o == CabalDev) da (optVerbose o) r s f b p) es
|
Devel da s f r b _ig es p t -> devel (DevelOpts (optCabalPgm o == CabalDev) da (optVerbose o) r s f b p t) es
|
||||||
Keter noRebuild -> keter (cabalCommand o) noRebuild
|
Keter noRebuild -> keter (cabalCommand o) noRebuild
|
||||||
Version -> do putStrLn ("yesod-core version:" ++ yesodVersion)
|
Version -> do putStrLn ("yesod-core version:" ++ yesodVersion)
|
||||||
putStrLn ("yesod version:" ++ showVersion Paths_yesod.version)
|
putStrLn ("yesod version:" ++ showVersion Paths_yesod.version)
|
||||||
@ -152,6 +153,8 @@ develOptions = Devel <$> switch ( long "disable-api" <> short 'd'
|
|||||||
<*> extraCabalArgs
|
<*> extraCabalArgs
|
||||||
<*> option ( long "port" <> short 'p' <> value 3000 <> metavar "N"
|
<*> option ( long "port" <> short 'p' <> value 3000 <> metavar "N"
|
||||||
<> help "Devel server listening port" )
|
<> help "Devel server listening port" )
|
||||||
|
<*> option ( long "proxy-timeout" <> short 'x' <> value 10 <> metavar "N"
|
||||||
|
<> help "Devel server timeout before returning 'not ready' message (in seconds)" )
|
||||||
|
|
||||||
extraCabalArgs :: Parser [String]
|
extraCabalArgs :: Parser [String]
|
||||||
extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
|
extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user