Skip to content

Commit 7fb3816

Browse files
authored
[symfony/mercure-bundle] Make MERCURE_URL optional to allow use of FrankenPHP's built-in Mercure (symfony#1514)
1 parent 3f11f2a commit 7fb3816

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
mercure:
2+
hubs:
3+
default:
4+
url: '%env(default::MERCURE_URL)%'
5+
public_url: '%env(MERCURE_PUBLIC_URL)%'
6+
jwt:
7+
secret: '%env(MERCURE_JWT_SECRET)%'
8+
publish: '*'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"bundles": {
3+
"Symfony\\Bundle\\MercureBundle\\MercureBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"config/": "%CONFIG_DIR%/"
7+
},
8+
"env": {
9+
"#1": "See https://symfony.com/doc/current/mercure.html#configuration",
10+
"#2": "The URL of the Mercure hub, used by the app to publish updates (can be a local URL)",
11+
"MERCURE_URL": "https://example.com/.well-known/mercure",
12+
"#3": "The public URL of the Mercure hub, used by the browser to connect",
13+
"MERCURE_PUBLIC_URL": "https://example.com/.well-known/mercure",
14+
"#4": "The secret used to sign the JWTs",
15+
"MERCURE_JWT_SECRET": "!ChangeThisMercureHubJWTSecretKey!"
16+
},
17+
"docker-compose": {
18+
"docker-compose.yml": {
19+
"services": [
20+
"mercure:",
21+
" image: dunglas/mercure",
22+
" restart: unless-stopped",
23+
" environment:",
24+
" # Uncomment the following line to disable HTTPS,",
25+
" #SERVER_NAME: ':80'",
26+
" MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'",
27+
" MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'",
28+
" # Set the URL of your Symfony project (without trailing slash!) as value of the cors_origins directive",
29+
" MERCURE_EXTRA_DIRECTIVES: |",
30+
" cors_origins http://127.0.0.1:8000",
31+
" # Comment the following line to disable the development mode",
32+
" command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile",
33+
" healthcheck:",
34+
" test: [\"CMD\", \"curl\", \"-f\", \"https://localhost/healthz\"]",
35+
" timeout: 5s",
36+
" retries: 5",
37+
" start_period: 60s",
38+
" volumes:",
39+
" - mercure_data:/data",
40+
" - mercure_config:/config"
41+
],
42+
"volumes": ["mercure_data:", "mercure_config:"]
43+
},
44+
"docker-compose.override.yml": {
45+
"services": [
46+
"mercure:",
47+
" ports:",
48+
" - \"80\""
49+
]
50+
}
51+
},
52+
"aliases": ["mercure"]
53+
}

0 commit comments

Comments
 (0)