Bladeren bron

mercure functional in anonymous mode

Olivier Massot 3 jaren geleden
bovenliggende
commit
b0be09b1a8
4 gewijzigde bestanden met toevoegingen van 10 en 8 verwijderingen
  1. 5 4
      .env
  2. 1 1
      .env.preprod
  3. 2 1
      config/packages/mercure.yaml
  4. 2 2
      src/Message/Handler/ExportHandler.php

+ 5 - 4
.env

@@ -74,9 +74,10 @@ MESSENGER_TRANSPORT_DSN=doctrine://default
 ###> symfony/mercure-bundle ###
 # See https://symfony.com/doc/current/mercure.html#configuration
 # The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
-MERCURE_URL=https://mercure.opentalent.fr/.well-known/mercure
+MERCURE_URL=http://mercure/.well-known/mercure
 # The public URL of the Mercure hub, used by the browser to connect
-MERCURE_PUBLIC_URL=https://mercure.opentalent.fr/.well-known/mercure
-# The secret used to sign the JWTs
-MERCURE_JWT_SECRET=Ct0JFujZq34FO8q40s2DFvdi1R15wrc2x6qS4hSNspqoM2zr0Ckolr6HfnlGkGU2BxmseCE9j8hl74Z0Eac7lykNs46jpQUYdrAauo0yYoSkL9cqxJct3WCxMhyLWFhx
+MERCURE_PUBLIC_URL=https://local.mercure.opentalent.fr/.well-known/mercure
+# The secret key used to sign the JWTs
+#MERCURE_JWT_KEY=UfQm7bdbXSO0TDnxGREM6BPtwUgls7ZWJhAl21VsuwW8rSvyHG3yqOkPEpr9sEmo
+MERCURE_JWT_SECRET=UfQm7bdbXSO0TDnxGREM6BPtwUgls7ZWJhAl21VsuwW8rSvyHG3yqOkPEpr9sEmo
 ###< symfony/mercure-bundle ###

+ 1 - 1
.env.preprod

@@ -34,5 +34,5 @@ MERCURE_URL=https://preprod.mercure.opentalent.fr/.well-known/mercure
 # The public URL of the Mercure hub, used by the browser to connect
 MERCURE_PUBLIC_URL=https://preprod.mercure.opentalent.fr/.well-known/mercure
 # The secret used to sign the JWTs
-MERCURE_JWT_SECRET=Ct0JFujZq34FO8q40s2DFvdi1R15wrc2x6qS4hSNspqoM2zr0Ckolr6HfnlGkGU2BxmseCE9j8hl74Z0Eac7lykNs46jpQUYdrAauo0yYoSkL9cqxJct3WCxMhyLWFhx
+MERCURE_JWT_SECRET=UfQm7bdbXSO0TDnxGREM6BPtwUgls7ZWJhAl21VsuwW8rSvyHG3yqOkPEpr9sEmo
 ###< symfony/mercure-bundle ###

+ 2 - 1
config/packages/mercure.yaml

@@ -5,4 +5,5 @@ mercure:
             public_url: '%env(MERCURE_PUBLIC_URL)%'
             jwt:
                 secret: '%env(MERCURE_JWT_SECRET)%'
-                publish: '*'
+                algorithm: 'hmac.sha256'
+                publish: ['*']

+ 2 - 2
src/Message/Handler/ExportHandler.php

@@ -24,9 +24,9 @@ class ExportHandler implements MessageHandlerInterface
             $exportService = $this->handler->getExporterFor($exportRequest);
             $file = $exportService->export($exportRequest);
 
-            $update = new Update('files/' . $file->getId());
+            $update = new Update('files', json_encode(['url' => 'https://my.download.url/' . $file->getId()]));
             $this->mercureHub->publish($update);
-            
+
         } catch (\Exception $e) {
             // To prevent Messenger from retrying
             throw new UnrecoverableMessageHandlingException($e->getMessage(), $e->getCode(), $e);