From 23e07e52c7b011494b6a6dc84689e41eb780dd11 Mon Sep 17 00:00:00 2001 From: Daniel West Date: Thu, 16 Sep 2021 13:16:44 +0100 Subject: [PATCH 1/2] Update the environment variables used for Mercure Since API Platform 2.6.5 the `mercure.hub_url` configuration is ignored if the Mercure bundle used is version ^0.3 and includes the `Discovery` class The environment variables for the Mercure component are different so I have updated this documentation. I have not mentioned there is an option to use the `hub_url` configuration option. It may be worth mentioning in a comment on the configuration that the option is deprecated. also see: https://github.com/api-platform/core/issues/4451 The link to the Symfony external parameter configuration was also broken. --- core/mercure.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/mercure.md b/core/mercure.md index 75514f57abf..c19b65b3d47 100644 --- a/core/mercure.md +++ b/core/mercure.md @@ -25,11 +25,13 @@ Then, install the Symfony bundle: composer require symfony/mercure-bundle ``` -Finally, 3 environment variables [must be set](https://symfony.com/doc/current/configuration/external_parameters.html): +Finally, 3 environment variables [must be set](See configuring Symfony with environment variables https://symfony.com/doc/current/configuration.html): -* `MERCURE_PUBLISH_URL`: the URL that must be used by API Platform to publish updates to your Mercure hub (can be an internal or a public URL) -* `MERCURE_SUBSCRIBE_URL`: the **public** URL of the Mercure hub that clients will use to subscribe to updates -* `MERCURE_JWT_TOKEN`: a valid Mercure [JSON Web Token (JWT)](https://jwt.io/) allowing API Platform to publish updates to the hub +* `MERCURE_URL`: the URL that must be used by API Platform to publish updates to your Mercure hub (can be an internal or a public URL) +* `MERCURE_PUBLIC_URL`: the **public** URL of the Mercure hub that clients will use to subscribe to updates +* `MERCURE_JWT_SECRET`: a valid Mercure [JSON Web Token (JWT)](https://jwt.io/) allowing API Platform to publish updates to the hub + +Api Platform uses the Symfony Mercure component. For more information, see https://symfony.com/doc/current/mercure.html The JWT **must** contain a `mercure.publish` property containing an array of topic selectors. This array can be empty to allow publishing anonymous updates only. It can also be `["*"]` to allow publishing on every topics. From 02e0404b5e61db9f91996ea0e0882d8bef9337c7 Mon Sep 17 00:00:00 2001 From: Alan Poulain Date: Fri, 1 Oct 2021 10:49:03 +0200 Subject: [PATCH 2/2] Apply suggestions from code review --- core/mercure.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/mercure.md b/core/mercure.md index c19b65b3d47..826c49c63f7 100644 --- a/core/mercure.md +++ b/core/mercure.md @@ -25,14 +25,12 @@ Then, install the Symfony bundle: composer require symfony/mercure-bundle ``` -Finally, 3 environment variables [must be set](See configuring Symfony with environment variables https://symfony.com/doc/current/configuration.html): +Finally, 3 environment variables [must be set](https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables): * `MERCURE_URL`: the URL that must be used by API Platform to publish updates to your Mercure hub (can be an internal or a public URL) * `MERCURE_PUBLIC_URL`: the **public** URL of the Mercure hub that clients will use to subscribe to updates * `MERCURE_JWT_SECRET`: a valid Mercure [JSON Web Token (JWT)](https://jwt.io/) allowing API Platform to publish updates to the hub -Api Platform uses the Symfony Mercure component. For more information, see https://symfony.com/doc/current/mercure.html - The JWT **must** contain a `mercure.publish` property containing an array of topic selectors. This array can be empty to allow publishing anonymous updates only. It can also be `["*"]` to allow publishing on every topics. [Example publisher JWT](https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.obDjwCgqtPuIvwBlTxUEmibbBf0zypKCNzNKP7Op2UM) (demo key: `!ChangeMe!`).