feat: improve default config

This commit is contained in:
Kévin Dunglas 2023-08-24 15:40:38 +02:00
parent f5b599bc2b
commit a6603b58cc
2 changed files with 27 additions and 3 deletions

View File

@ -1,6 +1,5 @@
{
# Debug
{$CADDY_DEBUG}
{$CADDY_GLOBAL_OPTIONS}
frankenphp {
#worker /path/to/your/worker.php
@ -13,6 +12,22 @@
log
route {
root * public/
mercure {
# Transport to use (default to Bolt)
transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
# Publisher JWT key
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
# Subscriber JWT key
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
# Allow anonymous subscribers (double-check that it's what you want)
anonymous
# Enable the subscription API (double-check that it's what you want)
subscriptions
# Extra directives
{$MERCURE_EXTRA_DIRECTIVES}
}
vulcain
# Add trailing slash for directory requests
@canonicalPath {
file {path}/index.php

View File

@ -8,13 +8,22 @@ You can also configure PHP using `php.ini` as usual.
In the Docker image, the `php.ini` file is located at `/usr/local/lib/php.ini`.
## Environment Variables
The following environment variables can be used to inject Caddy directives in the `Caddyfile` without modifying it:
* `SERVER_NAME` change the server name
* `CADDY_GLOBAL_OPTIONS`: inject [global options](https://caddyserver.com/docs/caddyfile/options)
* `FRANKENPHP_CONFIG`: inject config under the `frankenphp` directive
## Enable the Debug Mode
When using the Docker image, set the `CADDY_DEBUG` environment variable to `debug` to enable the debug mode:
```
docker run -v $PWD:/app/public \
-e CADDY_DEBUG=debug \
-e CADDY_GLOBAL_OPTIONS=debug \
-p 80:80 -p 443:443 \
dunglas/frankenphp
```