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 - Version 6. Bundle config1 +2. Bundle config - Content
-
... ... @@ -2,11 +2,6 @@ 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 - 10 10 (% class="wikigeneratedid" %) 11 11 All bundle settings are located in the file {{code language="none"}}config/packages/ufo_json_rpc.yaml{{/code}}. 12 12 ... ... @@ -60,6 +60,7 @@ 60 60 61 61 62 62 58 + 63 63 == Parameter {{code language="none"}}clients_tokens{{/code}} == 64 64 65 65 Now you need to specify an array of client tokens that will have access to the API. ... ... @@ -166,24 +166,6 @@ 166 166 class: App\Services\RpcSecurity\UserTokenValidator 167 167 {{/code}} 168 168 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 - 187 187 = The {{code language="none"}}docs{{/code}} block = 188 188 189 189 This block configures the generation of documentation when you make a GET request on the RPC Server ... ... @@ -216,65 +216,6 @@ 216 216 key_for_methods: some_custom_key 217 217 {{/code}} 218 218 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 - 278 278 === Parameter {{code language="none"}}validations{{/code}} === 279 279 280 280 Responsible for displaying in the documentation methods additional blocks that indicate data validation requirements. ... ... @@ -299,7 +299,7 @@ 299 299 (% class="box infomessage" %) 300 300 ((( 301 301 In this example, I removed the content of the objects symfony_assertions to simplify the example. 302 -For more information on method validation, see the page **[[Validate procedures>>doc: docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]]**221 +For more information on method validation, see the page **[[Validate procedures>>doc:.add_rpc_service.assertions.WebHome]]** 303 303 ))) 304 304 305 305 {{code language="json" layout="LINENUMBERS" title="GET: /api"}}