wai-middleware-delegate 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+31/−86 lines, 4 filesdep +fmtdep −mustachedep ~textPVP ok
version bump matches the API change (PVP)
Dependencies added: fmt
Dependencies removed: mustache
Dependency ranges changed: text
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- templates/nginx-test.conf.mustache +0/−42
- test/Test/NginxGateway.hs +23/−39
- wai-middleware-delegate.cabal +4/−5
ChangeLog.md view
@@ -2,6 +2,10 @@ `wai-middleware-delegate` uses [PVP Versioning][1]. +## 0.2.0.1 -- 2025-03-19++* Relax the upper bounds on the text dependency+ ## 0.2.0.0 -- 2024-11-05 * Relax the upper bounds of the data-default version used by the tests
− templates/nginx-test.conf.mustache
@@ -1,42 +0,0 @@-server {- listen 80;- listen [::]:80;- server_name {{common_name}};- location / {- rewrite ^ https://$host$request_uri? permanent;- }-}--server {- listen 443 ssl;- listen [::]:443 ssl;- server_name {{commonName}};- server_tokens off;- ssl_certificate /etc/tmp-proc/certs/certificate.pem;- ssl_certificate_key /etc/tmp-proc/certs/key.pem;- ssl_buffer_size 8k;- ssl_protocols TLSv1.2;- ssl_prefer_server_ciphers on;- ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;- ssl_ecdh_curve secp384r1;- ssl_session_tickets off;- ssl_stapling on;- ssl_stapling_verify on;- resolver 8.8.8.8;-- location / {- try_files $uri @tmp-proc-target;- }-- location @tmp-proc-target {- proxy_pass http://{{targetName}}:{{targetPort}};- add_header X-Frame-Options "SAMEORIGIN" always;- add_header X-XSS-Protection "1; mode=block" always;- add_header X-Content-Type-Options "nosniff" always;- add_header Referrer-Policy "no-referrer-when-downgrade" always;- add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;- }-- root /var/www/html;- index index.html index.htm index.nginx-debian.html;-}
test/Test/NginxGateway.hs view
@@ -30,6 +30,7 @@ import Data.Text (Text) import qualified Data.Text as Text import qualified Data.Text.IO as Text+import Fmt ((+|), (|+)) import Network.Connection.CPP (noCheckSettings) import qualified Network.HTTP.Client as HC import qualified Network.HTTP.Client.TLS as HC@@ -53,13 +54,6 @@ , toPinged ) import Test.Certs.Temp (CertPaths (..), defaultConfig, generateAndStore)-import Text.Mustache- ( ToMustache (..)- , automaticCompile- , object- , substitute- , (~>)- ) -- | Run Nginx as a temporary process.@@ -94,13 +88,13 @@ deriving (Eq, Show) -instance ToMustache NginxGateway where- toMustache nt =- object- [ "commonName" ~> ngCommonName nt- , "targetPort" ~> ngTargetPort nt- , "targetName" ~> ngTargetName nt- ]+substitute' :: Text -> (NginxGateway, NginxPrep) -> Text+substitute' template (ng, np) =+ let withCName = Text.replace "{commonName}" (ngCommonName ng)+ withTName = Text.replace "{targetName}" (ngTargetName ng)+ withPort = Text.replace "{targetPort}" ("" +| ngTargetPort ng |+ "")+ withTargetDir = Text.replace "{targetDir}" (Text.pack (npVolumeRoot np))+ in withCName $ withTName $ withPort $ withTargetDir template -- | Values obtained while preparing to launch the nginx container@@ -112,13 +106,6 @@ deriving (Eq, Show) -instance ToMustache NginxPrep where- toMustache np =- object- [ "targetDir" ~> npVolumeRoot np- ]-- templateName :: FilePath templateName = "nginx-test.conf.mustache" @@ -181,24 +168,21 @@ Nothing -> error $ "could not find host " <> show name Just _ -> do templateDir <- (</> "templates") <$> getDataDir- compiled <- automaticCompile [templateDir] templateName- case compiled of- Left err -> error $ "the template did not compile:" ++ show err- Right template -> do- npVolumeRoot <- createWorkingDirs- npUserID <- getEffectiveUserID- npGroupID <- getEffectiveGroupID- let (confDir, cpDir) = toConfCertsDirs npVolumeRoot- cp =- CertPaths- { cpKey = "key.pem"- , cpCert = "certificate.pem"- , cpDir- }- np = NginxPrep {npUserID, npGroupID, npVolumeRoot}- generateAndStore cp defaultConfig- Text.writeFile (confDir </> "nginx.conf") $ substitute template (nt, np)- pure np+ templateTxt <- Text.readFile (templateDir </> templateName)+ npVolumeRoot <- createWorkingDirs+ npUserID <- getEffectiveUserID+ npGroupID <- getEffectiveGroupID+ let (confDir, cpDir) = toConfCertsDirs npVolumeRoot+ cp =+ CertPaths+ { cpKey = "key.pem"+ , cpCert = "certificate.pem"+ , cpDir+ }+ np = NginxPrep {npUserID, npGroupID, npVolumeRoot}+ generateAndStore cp defaultConfig+ Text.writeFile (confDir </> "nginx.conf") $ substitute' templateTxt (nt, np)+ pure np -- | Make a uri access the http-bin server.
wai-middleware-delegate.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: wai-middleware-delegate-version: 0.2.0.0+version: 0.2.0.1 synopsis: WAI middleware that delegates handling of requests. description: [WAI](http://hackage.haskell.org/package/wai) middleware that intercepts requests@@ -14,6 +14,7 @@ author: Tim Emiola maintainer: tim.emiola@gmail.com category: Web+tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.6 || ==9.8.2 || ==9.10.1 homepage: https://github.com/adetokunbo/wai-middleware-delegate#readme @@ -22,8 +23,6 @@ build-type: Simple extra-source-files: ChangeLog.md-data-files:- templates/*.mustache source-repository head type: git@@ -44,7 +43,7 @@ , http-client-tls >=0.3 && <0.4 , http-types >=0.12.1 && <0.13 , streaming-commons >=0.2.1 && <0.3- , text >=1.2.3 && <2.1.2+ , text >=1.2.3 && <2.3 , wai ^>=3.2 , wai-conduit ^>=3.0.0.4 @@ -79,12 +78,12 @@ , data-default >=0.7 && <0.9 , directory >=1.3 && <1.4 , filepath >=1.4 && <1.6+ , fmt >=0.6.3 && <0.8 , hspec >=2.1 , hspec-tmp-proc , http-client , http-client-tls , http-types- , mustache >=2.3 && <2.5 , network , random >=1.1 , resourcet