Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 4804ab3

Browse files
author
Dimitri Pfaffenrodt
committed
Add support to provide first client via env
1 parent 2518882 commit 4804ab3

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.github/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
## [Unreleased] - YYYY-MM-DD
1010

1111
### Added
12-
- replace env `authHost` in config.json with LARAVEL_ECHO_AUTH_HOST
12+
- replace env `authHost` in config.json with `LARAVEL_ECHO_AUTH_HOST`
1313
- add default cors settings
14-
- replace env allowOrigin in config.json with LARAVEL_ECHO_ALLOW_ORIGIN
15-
14+
- replace env allowOrigin in config.json with `LARAVEL_ECHO_ALLOW_ORIGIN`
15+
- support to create initial app client with `LARAVEL_ECHO_CLIENT_APP_ID` and `LARAVEL_ECHO_CLIENT_APP_KEY`
1616
### Changed
1717
- Nothing
1818

.github/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ If some environment variables are existed (allow load `/app/.env` file is found)
121121
| `LARAVEL_ECHO_SERVER_AUTH_HOST` | `authHost` | This option will fall back to the `LARAVEL_ECHO_SERVER_HOST` option as the default if that is set. |
122122
| `LARAVEL_ECHO_SERVER_HOST` | `host` | |
123123
| `LARAVEL_ECHO_SERVER_PORT` | `port` | |
124+
| `LARAVEL_ECHO_CLIENT_APP_ID` | `clients.0.appId` | optional: add first client with key `LARAVEL_ECHO_CLIENT_APP_KEY` |
125+
| `LARAVEL_ECHO_CLIENT_APP_KEY` | `clients.0.key` | |
124126
| `LARAVEL_ECHO_SERVER_DEBUG` | `devMode` | |
125127
| `LARAVEL_ECHO_SERVER_REDIS_HOST` | `databaseConfig.redis.host` | |
126128
| `LARAVEL_ECHO_SERVER_REDIS_PORT` | `databaseConfig.redis.port` | |

bin/docker-entrypoint

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if [[ "$1" == 'start' ]] || [[ "$1" == 'client:add' ]] || [[ "$1" == 'client:rem
2424
# Replace with environment variables
2525
sed -i "s|LARAVEL_ECHO_AUTH_HOST|${LARAVEL_ECHO_AUTH_HOST:-${LARAVEL_ECHO_SERVER_HOST:-localhost}}|i" /app/laravel-echo-server.json
2626
sed -i "s|LARAVEL_ECHO_ALLOW_ORIGIN|${LARAVEL_ECHO_ALLOW_ORIGIN:-${LARAVEL_ECHO_AUTH_HOST:-${LARAVEL_ECHO_SERVER_HOST:-localhost}}}|i" /app/laravel-echo-server.json
27+
LARAVEL_ECHO_CLIENTS="[]"
28+
if [ ! -z "${LARAVEL_ECHO_CLIENT_APP_ID}" ]; then
29+
LARAVEL_ECHO_CLIENTS="[{\"appId\": \"${LARAVEL_ECHO_CLIENT_APP_ID}\",\"key\": \"${LARAVEL_ECHO_CLIENT_APP_KEY}\"}]"
30+
fi
31+
sed -i "s|\"LARAVEL_ECHO_CLIENTS\"|${LARAVEL_ECHO_CLIENTS}|i" /app/laravel-echo-server.json
2732
sed -i "s|LARAVEL_ECHO_SERVER_DB|${LARAVEL_ECHO_SERVER_DB:-redis}|i" /app/laravel-echo-server.json
2833
sed -i "s|REDIS_HOST|${REDIS_HOST:-redis}|i" /app/laravel-echo-server.json
2934
sed -i "s|REDIS_PORT|${REDIS_PORT:-6379}|i" /app/laravel-echo-server.json

src/laravel-echo-server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"authEndpoint": "/broadcasting/auth",
99
"authHost": "LARAVEL_ECHO_AUTH_HOST",
10-
"clients": [],
10+
"clients": "LARAVEL_ECHO_CLIENTS",
1111
"database": "LARAVEL_ECHO_SERVER_DB",
1212
"databaseConfig": {
1313
"redis": {

0 commit comments

Comments
 (0)