Description
Hi!
First of all, thanks a lot for this skeleton.
I'm trying to make async updates work with Mercure, allowing only authenticated updates and subscribers - however there's some things I do not understand yet.
In the docker-compose.yml at line 26 we see the following configuration:
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
which is the same value that is passed to Caddy on lines 36/37:
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
-
As they all share the same value (both the default value as well as whatever the user defines as
$CADDY_MERCURE_JWT_SECRET
) I take it that these values should be identical. -
It seems that the
MERCURE_JWT_SECRET
environment variable inside thephp
service relates to theMERCURE_JWT_SECRET
within.env
- which by default reads:
# The secret used to sign the JWTs
MERCURE_JWT_SECRET="!ChangeMe!"
So I would take it that these values should be cryptographically random values, which would be used as the secret passphrase to sign and verify JWTs.
However, the documentation for configuring Mercure within API Platform says the following:
MERCURE_JWT_SECRET
: a valid Mercure JSON Web Token (JWT) allowing API Platform to publish updates to the hub
The JWT must contain a mercure.publish property containing an array of topic selectors
which at least conflicts with the comment inside .env
, and if the rest of my understanding is correct, also conflicts with the configuration inside docker-compose.yml
.
So my question boils down to the following:
-
Should the
publisher_jwt
andsubscriber_jwt
values within the Caddyfile indeed contain a cryptographically random value? -
Should the
MERCURE_JWT_SECRET
within.env
indeed contain a JWT, which should be signed with the cryptographically randompublisher_jwt
value?