packages feed

ngx-export-tools 0.3.2.0 → 0.3.3.0

raw patch · 3 files changed

+27/−9 lines, 3 filesdep ~ngx-exportPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ngx-export

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,3 +1,10 @@+### 0.3.3.0++- In case of unreadable configuration, terminate the worker process by throwing+  exception *TerminateWorkerProcess* which makes Nginx log the supplied message+  and exit. To use this exception, the constraint on the version of the package+  *ngx-export* was increased.+ ### 0.3.2.0  - Do not pass the *first-run* flag to simple services with the
NgxExport/Tools.hs view
@@ -62,6 +62,7 @@ import           Data.Aeson import           Control.Monad import           Control.Arrow+import           Control.Exception import           Control.Concurrent import           GHC.Generics import           System.IO.Unsafe (unsafePerformIO)@@ -517,28 +518,30 @@     let nameF = nameBase f         nameSsf = mkName $ "simpleService_" ++ nameF         hasConf = isJust c-        (sNameC, typeC, isJSON) =+        (sNameC, typeC, readConf, unreadableConfMsg) =             if hasConf                 then let c' = fromJust c                          tName = nameBase $ fst c'                      in (mkName $ "storage_" ++ tName ++ '_' : nameF                         ,conT $ mkName tName-                        ,snd c'+                        ,if snd c'+                             then [|readFromByteStringAsJSON|]+                             else [|readFromByteString|]+                        ,[|"Configuration " ++ tName ++ " is not readable"|]                         )                 else undefined         initConf =             let eConfBs = varE confBs             in if hasConf                    then let storage = varE sNameC-                            readConf = if isJSON-                                           then [|readFromByteStringAsJSON|]-                                           else [|readFromByteString|]                         in [|readIORef $(storage) >>=                                  maybe (do                                             let conf_data__ =                                                     $(readConf) $(eConfBs)-                                            when (isNothing conf_data__)-                                                terminateWorkerProcess+                                            when (isNothing conf_data__) $+                                                throwIO $+                                                    TerminateWorkerProcess+                                                        $(unreadableConfMsg)                                             writeIORef $(storage) conf_data__                                             return conf_data__                                        ) (return . Just)@@ -638,6 +641,10 @@ -- elsewhere by a name comprised of the name of the custom type and the name of -- the service connected by an underscore and prefixed as a whole word with -- __/storage_/__. The stored data is wrapped in 'Maybe' container.+--+-- When reading of the custom object fails on the first service run, the+-- service terminates the worker process by throwing an exception+-- 'TerminateWorkerProcess' with a corresponding message. ngxExportSimpleServiceTyped :: Name         -- ^ Name of the service                             -> Name         -- ^ Name of the custom type                             -> ServiceMode  -- ^ Service mode@@ -666,6 +673,10 @@ -- elsewhere by a name comprised of the name of the custom type and the name of -- the service connected by an underscore and prefixed as a whole word with -- __/storage_/__. The stored data is wrapped in 'Maybe' container.+--+-- When reading of the custom object fails on the first service run, the+-- service terminates the worker process by throwing an exception+-- 'TerminateWorkerProcess' with a corresponding message. ngxExportSimpleServiceTypedAsJSON :: Name         -- ^ Name of the service                                   -> Name         -- ^ Name of the custom type                                   -> ServiceMode  -- ^ Service mode
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-tools-version:                    0.3.2.0+version:                    0.3.3.0 synopsis:                   Extra tools for Nginx haskell module description:                Extra tools for         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.@@ -20,7 +20,7 @@                           , template-haskell >= 2.11.0.0                           , bytestring >= 0.10.0.0                           , binary >= 0.4-                          , ngx-export >= 1.5.0+                          , ngx-export >= 1.6.2                           , aeson >= 1.0                           , safe