From 8f1912f7363d06281b053c42f2303642215ef936 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 8 Nov 2024 12:45:01 +0100 Subject: [PATCH] Update mercure.rst: Actually using the env vars Page: https://symfony.com/doc/5.x/mercure.html#configuration Reason: The above paragraph explains how to set all those vars in `.env`, but then the code sample didn't use it ;-) --- mercure.rst | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/mercure.rst b/mercure.rst index e05f9033876..58ffdde9182 100644 --- a/mercure.rst +++ b/mercure.rst @@ -130,11 +130,12 @@ MercureBundle provides a more advanced configuration: mercure: hubs: default: - url: https://mercure-hub.example.com/.well-known/mercure + url: '%env(string:MERCURE_URL)%' + public_url: '%env(string:MERCURE_PUBLIC_URL)%' jwt: - secret: '!ChangeThisMercureHubJWTSecretKey!' - publish: ['foo', 'https://example.com/foo'] - subscribe: ['bar', 'https://example.com/bar'] + secret: '%env(string:MERCURE_JWT_SECRET)%' + publish: ['https://example.com/foo1', 'https://example.com/foo2'] + subscribe: ['https://example.com/bar1', 'https://example.com/bar2'] algorithm: 'hmac.sha256' provider: 'My\Provider' factory: 'My\Factory' @@ -147,19 +148,20 @@ MercureBundle provides a more advanced configuration: + url="%env(string:MERCURE_URL)%" + public_url="%env(string:MERCURE_PUBLIC_URL)%" + > - foo - https://example.com/foo - bar - https://example.com/bar + https://example.com/foo1 + https://example.com/foo2 + https://example.com/bar1 + https://example.com/bar2 @@ -170,11 +172,12 @@ MercureBundle provides a more advanced configuration: $container->loadFromExtension('mercure', [ 'hubs' => [ 'default' => [ - 'url' => 'https://mercure-hub.example.com/.well-known/mercure', + 'url' => '%env(string:MERCURE_URL)%', + 'public_url' => '%env(string:MERCURE_PUBLIC_URL)%', 'jwt' => [ - 'secret' => '!ChangeThisMercureHubJWTSecretKey!', - 'publish' => ['foo', 'https://example.com/foo'], - 'subscribe' => ['bar', 'https://example.com/bar'], + 'secret' => '%env(string:MERCURE_JWT_SECRET)%', + 'publish' => ['https://example.com/foo1', 'https://example.com/foo2'], + 'subscribe' => ['https://example.com/bar1', 'https://example.com/bar2'], 'algorithm' => 'hmac.sha256', 'provider' => 'My\Provider', 'factory' => 'My\Factory',