Skip to content

Conversation

@7-zete-7
Copy link
Contributor

Fixes #870

The MERCURE_TRANSPORT_URL env has been removed and replaced by the mercure.transport Caddy directive.

BREAKING CHANGE: The MERCURE_TRANSPORT_URL env is no longer available.

Update guide

Instead of using the MERCURE_TRANSPORT_URL env, use the MERCURE_BOLT_PATH and MERCURE_BOLT_EXTRA_DIRECTIVES envs.

  • Old usage:

    MERCURE_TRANSPORT_URL=bolt:///var/mercure.db

    New usage:

    MERCURE_BOLT_PATH=/var/mercure.db
  • Old usage:

    MERCURE_TRANSPORT_URL=bolt:///data/mercure.db?cleanup_frequency=0.2

    New usage:

    MERCURE_BOLT_PATH=/data/mercure.db
    MERCURE_BOLT_EXTRA_DIRECTIVES=cleanup_frequency 0.2

See https://github.com/dunglas/mercure/blob/c7cf56e647e87aa814331e5ebf6672cae1ed2a54/docs/UPGRADE.md#017

@shulard
Copy link

shulard commented Dec 9, 2025

Hello !

I faced the same issue (having the bolt.db file at my project root). With this MR it's mandatory to use the bolt transport driver by default.

Do you think it's interesting to also add variable for the transport type like this:

transport {$MERCURE_TRANSPORT_TYPE:bolt} {
    path {$MERCURE_BOLT_PATH:/data/mercure.db}
    {$MERCURE_BOLT_EXTRA_DIRECTIVES}
}

Or maybe if we define another transport in the MERCURE_EXTRA_DIRECTIVES it'll override the previous definition ?

@7-zete-7
Copy link
Contributor Author

7-zete-7 commented Dec 9, 2025

Hi, @shulard!

Adding the ability to configure transports via an environment variable like MERCURE_TRANSPORT_TYPE won't work because transports have different configuration options (see the Transports section at https://mercure.rocks/docs/hub/cluster).

Defining a different transport in the MERCURE_EXTRA_DIRECTIVES does indeed override the previous directive. But I'm not sure this is a valid configuration and won't cause errors in the future.

In some of my projects, I removed the entire transport directive from the Caddyfile and moved it to the MERCURE_EXTRA_DIRECTIVES environment variable in the compose.yaml file as the default behavior. This makes it possible to configure transports via, for example, the compose.prod.yaml file. However, this results in a multi-line environment variable and a more complex compose.yaml file.

@shulard
Copy link

shulard commented Dec 10, 2025

Ok thank you for the feedback. If it works in MERCURE_EXTRA_DIRECTIVES with multi line env var it's fine.

@dunglas
Copy link
Owner

dunglas commented Dec 10, 2025

IMHO we should just set MERCURE_EXTRA_DIRECTIVES as well as a volume to store the bolt file in compose.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mercure transport is not configurable since FrankenPHP v1.10

3 participants