From 609e6930712559a7b14594e35247c4f62ab552f9 Mon Sep 17 00:00:00 2001 From: Alexey Radkov Date: Sun, 18 Feb 2024 15:04:57 +0400 Subject: [PATCH] docs updated --- Changelog.md | 6 ++++-- NgxExport/Tools/Subrequest.hs | 20 +++++++++++++------- README.md | 6 +++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Changelog.md b/Changelog.md index cfe0529..21f8ca4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,9 @@ ### 1.2.8 -- Module *NgxExport.Tools.Subrequest*: allow setting custom HTTP managers in - subrequest configurations. +- Module *NgxExport.Tools.Subrequest*. + + Allow setting custom HTTP managers in subrequest configurations. + + In subrequest configurations, field *useUDS* / *srUseUDS* is no longer + accepted, use *"manager": "uds"* / *srManager = UDS* instead. ### 1.2.7 diff --git a/NgxExport/Tools/Subrequest.hs b/NgxExport/Tools/Subrequest.hs index ba5031a..bad97b4 100644 --- a/NgxExport/Tools/Subrequest.hs +++ b/NgxExport/Tools/Subrequest.hs @@ -521,8 +521,8 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService -- $subrequestsWithCustomManager -- -- To serve subrequests, a custom HTTP manager can be implemented and then --- configured in a custom service handler with 'registerCustomManager'. To --- enable this manager in the subrequest configuration, use field /manager/ +-- registered in a custom service handler with 'registerCustomManager'. To +-- enable this manager in a subrequest configuration, use field /manager/ -- with the key that was bound to the manager in 'registerCustomManager'. -- -- For example, let's implement a custom UDS manager which will serve @@ -564,7 +564,7 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService -- \'\/tmp\/myuds.sock\'; -- @ -- --- ==== File /nginx.conf/: location /\/uds/ with the custom manager /myuds/ +-- ==== File /nginx.conf/: location /\/uds/ with custom manager /myuds/ -- @ -- location \/uds { -- haskell_run_async __/makeSubrequest/__ $hs_subrequest @@ -583,11 +583,17 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService -- } -- @ --- | Register a custom HTTP manager with a given key. +-- | Registers a custom HTTP manager with a given key. -- --- Registered managers can be referred by the key from subrequest --- configurations in field /manager/ (in JSON-encoded configurations) or --- /srManager = Custom \"key\"/ (in /read/-encoded configurations). +-- The right place to register a custom manager is a custom service handler that +-- runs just after the start of an Nginx worker process. Registered managers can +-- then be referred to from subrequest configurations by the key in field +-- /manager/ (in JSON-encoded configurations) or as /srManager = Custom \"key\"/ +-- (in /read/-encoded configurations). +-- +-- Below is an example of a JSON-encoded subrequest configuration. +-- +-- > {"uri": "http://example.com/", "manager": "mymanager"} -- -- Note that keys /default/ and /uds/ have special meaning in field /manager/: -- they denote internal HTTP and UDS managers respectively. diff --git a/README.md b/README.md index 755b8b8..145168a 100644 --- a/README.md +++ b/README.md @@ -2048,8 +2048,8 @@ In backend, Custom-Header is 'Value' --- To serve subrequests, a custom HTTP manager can be implemented and then -configured in a custom service handler with *registerCustomManager*. To -enable this manager in the subrequest configuration, use field *manager* +registered in a custom service handler with *registerCustomManager*. To +enable this manager in a subrequest configuration, use field *manager* with the key that was bound to the manager in *registerCustomManager*. For example, let's implement a custom UDS manager which will serve @@ -2093,7 +2093,7 @@ ngxExportSimpleService 'configureUdsManager SingleShotService '/tmp/myuds.sock'; ``` -###### File *nginx.conf*: location */uds* with the custom manager *myuds* +###### File *nginx.conf*: location */uds* with custom manager *myuds* ```nginx location /uds {