Changes for page Версія 6: Налаштування
Last modified by Ashterix on 2024/07/11 10:08
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - 2. Bundle config1 +Version 6. Bundle config - Content
-
... ... @@ -2,6 +2,11 @@ 2 2 {{toc/}} 3 3 {{/box}} 4 4 5 +{{error}} 6 +WARNING!!!This version of the documentation is out of date. 7 +In JsonRpcBundle version 7, the configuration has undergone significant changes and is not backwards compatible with version 6. 8 +{{/error}} 9 + 5 5 (% class="wikigeneratedid" %) 6 6 All bundle settings are located in the file {{code language="none"}}config/packages/ufo_json_rpc.yaml{{/code}}. 7 7 ... ... @@ -55,7 +55,6 @@ 55 55 56 56 57 57 58 - 59 59 == Parameter {{code language="none"}}clients_tokens{{/code}} == 60 60 61 61 Now you need to specify an array of client tokens that will have access to the API. ... ... @@ -162,6 +162,24 @@ 162 162 class: App\Services\RpcSecurity\UserTokenValidator 163 163 {{/code}} 164 164 169 += Block {{code language="none"}}async{{/code}} = 170 + 171 +This block is for configuring [[asynchronous transport>>doc:docs.JsonRpcBundle.functionality.async.WebHome]]. 172 + 173 +Add the parameter {{code language="none"}}rpc_async{{/code}} which contains a string in DSN format. This string is the configuration for [[Symfony Messenger>>https://symfony.com/doc/current/messenger.html]], and it points to the asynchronous transport where the RPC Server will be waiting for incoming requests if you have a consumer running ({{code language="none"}}php bin/console messenger:consume rpc_async{{/code}}). For a more detailed understanding of this process, read the [[Symfony Messenger documentation>>https://symfony.com/doc/current/messenger.html]]. 174 + 175 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}} 176 +ufo_json_rpc: 177 + async: 178 + rpc_async: '%env(resolve:RPC_TRANSPORT_DSN)%' 179 + 180 +{{/code}} 181 + 182 +(% class="box warningmessage" %) 183 +((( 184 +This configuration implies that you have an environment variable RPC_TRANSPORT_DSN set, which contains the DSN string. 185 +))) 186 + 165 165 = The {{code language="none"}}docs{{/code}} block = 166 166 167 167 This block configures the generation of documentation when you make a GET request on the RPC Server ... ... @@ -194,6 +194,65 @@ 194 194 key_for_methods: some_custom_key 195 195 {{/code}} 196 196 219 +=== Parameter {{code language="none"}}async_dsn_info{{/code}} === 220 + 221 +Responsible for displaying information about asynchronous transport in the documentation. 222 + 223 +{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}} 224 +ufo_json_rpc: 225 + async_dsn_info: true # or false 226 +{{/code}} 227 + 228 +==== **Documentation Example** ==== 229 + 230 +{{code language="json" layout="LINENUMBERS" title="GET: /api"}} 231 +{ 232 + "envelope": "JSON-RPC-2.0/UFO-RPC-6", 233 + "contentType": "application/json", 234 + "description": "", 235 + "transport": { 236 + "sync": { 237 + "scheme": "http", 238 + "host": "example.com", 239 + "path": "/api", 240 + "method": "POST" 241 + }, 242 + "async": { 243 + "scheme": "amqp", 244 + "user": "{user}", 245 + "pass": "{pass}", 246 + "host": "async_rabbit", 247 + "port": 5672, 248 + "path": "/%2f/json-rpc" 249 + } 250 + }, 251 + "methods": { 252 + ... 253 + } 254 +} 255 +{{/code}} 256 + 257 +{{info}} 258 +Do not worry about the security of your authorization data contained in the DSN. 259 + 260 +The documenter is designed in such a way that before displaying DSN information, it removes user data and passwords, as well as other sensitive information, such as tokens, secret keys, etc. 261 + 262 +The template for protecting data is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}. 263 + 264 +Example: 265 + 266 +{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}} 267 +{ 268 + "async": { 269 + "scheme": "https", 270 + "host": "sqs.eu-west-3.amazonaws.com", 271 + "path": "/123456789012/messages", 272 + "query": "access_key={access_key}&secret_key={secret_key}" 273 + } 274 +} 275 +{{/code}} 276 +{{/info}} 277 + 197 197 === Parameter {{code language="none"}}validations{{/code}} === 198 198 199 199 Responsible for displaying in the documentation methods additional blocks that indicate data validation requirements. ... ... @@ -218,7 +218,7 @@ 218 218 (% class="box infomessage" %) 219 219 ((( 220 220 In this example, I removed the content of the objects symfony_assertions to simplify the example. 221 -For more information on method validation, see the page **[[Validate procedures>>doc:.add_rpc_service.assertions.WebHome]]** 302 +For more information on method validation, see the page **[[Validate procedures>>doc:docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]]** 222 222 ))) 223 223 224 224 {{code language="json" layout="LINENUMBERS" title="GET: /api"}}