Skip to content

Commit 43b39f6

Browse files
authored
fix: Mercure env vars (#1487)
1 parent 648990a commit 43b39f6

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

core/mercure.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,9 @@ Then, the Mercure hub dispatches the updates to all connected clients using [Ser
1616
Mercure support is already installed, configured and enabled in [the API Platform distribution](../distribution/index.md).
1717
If you use the distribution, you have nothing more to do, and you can skip to the next section.
1818

19-
If you have installed API Platform using another method (such as `composer require api`), you need to install a Mercure hub, and the [Symfony MercureBundle](https://symfony.com/doc/current/mercure.html):
19+
If you have installed API Platform using another method (such as `composer require api`), you need to install [a Mercure hub](https://mercure.rocks/docs/getting-started) and the Symfony MercureBundle.
2020

21-
First, [download and run a Mercure hub](https://mercure.rocks/docs/hub/install).
22-
Then, install the Symfony bundle:
23-
24-
```console
25-
composer require symfony/mercure-bundle
26-
```
27-
28-
Finally, 3 environment variables [must be set](https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables):
29-
30-
* `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)
31-
* `MERCURE_PUBLIC_URL`: the **public** URL of the Mercure hub that clients will use to subscribe to updates
32-
* `MERCURE_JWT_SECRET`: a valid Mercure [JSON Web Token (JWT)](https://jwt.io/) allowing API Platform to publish updates to the hub
33-
34-
The JWT **must** contain a `mercure.publish` property containing an array of topic selectors.
35-
This array can be empty to allow publishing anonymous updates only. It can also be `["*"]` to allow publishing on every topics.
36-
[Example publisher JWT](https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.obDjwCgqtPuIvwBlTxUEmibbBf0zypKCNzNKP7Op2UM) (demo key: `!ChangeMe!`).
37-
38-
[Learn more about Mercure authorization.](https://mercure.rocks/spec#authorization)
21+
[Learn how to install and configure MercureBundle manually on the Symfony website](https://symfony.com/doc/current/mercure.html)
3922

4023
## Pushing the API Updates
4124

@@ -72,7 +55,7 @@ Clients generated using [the API Platform Client Generator](../client-generator/
7255

7356
## Dispatching Private Updates (Authorized Mode)
7457

75-
Mercure allows to dispatch [private updates, that will be received only by authorized clients](https://mercure.rocks/spec#authorization).
58+
Mercure allows dispatching [private updates, that will be received only by authorized clients](https://mercure.rocks/spec#authorization).
7659
To receive this kind of updates, the client must hold a JWT containing at least one *target selector* matched by the update.
7760

7861
Then, use options to mark the published updates as privates:
@@ -117,7 +100,7 @@ In addition to `private`, the following options are available:
117100

118101
* `topics`: the list of topics of this update, if not the resource IRI is used
119102
* `data`: the content of this update, if not set the content will be the serialization of the resource using the default format
120-
* `id`: the SSE id of this event, if not set the ID will be generated by the mercure Hub
103+
* `id`: the SSE id of this event, if not set the ID will be generated by the Mercure Hub
121104
* `type`: the SSE type of this event, if not set this field is omitted
122105
* `retry`: the `retry` field of the SSE, if not set this field is omitted
123106
* `normalization_context`: the specific normalization context to use for the update.

0 commit comments

Comments
 (0)