yesod-bin 1.6.0.6 → 1.6.1
raw patch · 4 files changed
+21/−7 lines, 4 files
Files
- ChangeLog.md +4/−0
- Devel.hs +8/−5
- main.hs +8/−1
- yesod-bin.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for yesod-bin +## 1.6.1++Added command line options `cert` and `key` to allow TLS certificate and key files to be passed to `yesod devel` [#1717](https://github.com/yesodweb/yesod/pull/1717)+ ## 1.6.0.6 Fix the `add-handler` subcommand to support both the old default routes filename (`routes`) and the new one (`routes.yesodroutes`) [#1688](https://github.com/yesodweb/yesod/pull/1688)
Devel.hs view
@@ -56,7 +56,7 @@ responseLBS) import Network.Wai.Handler.Warp (defaultSettings, runSettings, setPort, setHost)-import Network.Wai.Handler.WarpTLS (runTLS,+import Network.Wai.Handler.WarpTLS (runTLS, tlsSettings, tlsSettingsMemory) import Network.Wai.Parse (parseHttpAccept) import Say@@ -126,6 +126,7 @@ , proxyTimeout :: Int , useReverseProxy :: Bool , develHost :: Maybe String+ , cert :: Maybe (FilePath, FilePath) } deriving (Show, Eq) -- | Run a reverse proxy from the develPort and develTlsPort ports to@@ -170,10 +171,12 @@ manager defaultSettings' = maybe id (setHost . fromString) (develHost opts) defaultSettings runProxyTls port app = do- let cert = $(embedFile "certificate.pem")- key = $(embedFile "key.pem")- tlsSettings = tlsSettingsMemory cert key- runTLS tlsSettings (setPort port defaultSettings') $ \req send -> do+ let certDef = $(embedFile "certificate.pem")+ keyDef = $(embedFile "key.pem")+ theSettings = case cert opts of+ Nothing -> tlsSettingsMemory certDef keyDef+ Just (c,k) -> tlsSettings c k+ runTLS theSettings (setPort port defaultSettings') $ \req send -> do let req' = req { requestHeaders = ("X-Forwarded-Proto", "https")
main.hs view
@@ -30,12 +30,13 @@ | Build { buildExtraArgs :: [String] } | Touch | Devel { develSuccessHook :: Maybe String- , develExtraArgs :: [String]+ , develExtraArgs :: [String] , develPort :: Int , develTlsPort :: Int , proxyTimeout :: Int , noReverseProxy :: Bool , develHost :: Maybe String+ , cert :: Maybe (FilePath, FilePath) } | DevelSignal | Test@@ -90,6 +91,7 @@ , proxyTimeout = proxyTimeout , useReverseProxy = not noReverseProxy , develHost = develHost+ , cert = cert } develExtraArgs DevelSignal -> develSignal where@@ -167,6 +169,11 @@ <> help "Disable reverse proxy" ) <*> optStr (long "host" <> metavar "HOST" <> help "Host interface to bind to; IP address, '*' for all interfaces, '*4' for IP4, '*6' for IP6")+ <*> optional ( (,)+ <$> strOption (long "cert" <> metavar "CERT"+ <> help "Path to TLS certificate file, requires that --key is also defined")+ <*> strOption (long "key" <> metavar "KEY"+ <> help "Path to TLS key file, requires that --cert is also defined") ) extraStackArgs :: Parser [String] extraStackArgs = many (strOption ( long "extra-stack-arg" <> short 'e' <> metavar "ARG"
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.6.0.6+version: 1.6.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>