docs: clarify docker-compose dollar sign escaping for bcrypt hashes

This commit is contained in:
Hördle Bot
2025-11-22 22:55:27 +01:00
parent aff752d4cb
commit fdc5594d69
3 changed files with 19 additions and 2 deletions

View File

@@ -71,7 +71,8 @@ Das Projekt ist für den Betrieb mit Docker optimiert.
Passe die Umgebungsvariablen in der `docker-compose.yml` an:
- `ADMIN_PASSWORD`: Admin-Passwort als Bcrypt-Hash.
Erstelle den Hash mit: `node scripts/hash-password.js <dein-passwort>`
Standard (admin123): `$2b$10$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq`
**Wichtig:** In `docker-compose.yml` müssen alle `$` Zeichen im Hash verdoppelt werden (`$$`), damit sie nicht als Variablen interpretiert werden!
Beispiel: `$$2b$$10$$...`
- `TZ`: Zeitzone für täglichen Puzzle-Wechsel (Standard: `Europe/Berlin`)
- `GOTIFY_URL`: URL deines Gotify Servers (z.B. `https://gotify.example.com`)
- `GOTIFY_APP_TOKEN`: App Token für Gotify (z.B. `A...`)
@@ -142,6 +143,19 @@ Eine vollständige Beispiel-Konfiguration findest du in `nginx.conf.example`.
- `proxy_buffering off;` - Deaktiviert Buffering für große Dateien
- `client_max_body_size 50M;` - Erlaubt große Uploads
### Admin Login schlägt fehl (Docker)
**Problem:** "Wrong password" trotz korrekt generiertem Hash.
**Ursache:** Docker Compose interpretiert `$` Zeichen im Hash als Variablen.
**Lösung:**
In der `docker-compose.yml` müssen alle `$` Zeichen im Hash verdoppelt werden (`$$`).
Falsch: `$2b$10$...`
Richtig: `$$2b$$10$$...`
Das Skript `node scripts/hash-password.js <pw>` gibt nun auch direkt den passenden String für Docker Compose aus.
## Lizenz
MIT

View File

@@ -10,7 +10,7 @@ services:
- "3010:3000"
environment:
- DATABASE_URL=file:/app/data/prod.db
- ADMIN_PASSWORD=$2b$10$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq # Change this! Must be a bcrypt hash. Use scripts/hash-password.js to generate.
- ADMIN_PASSWORD=$$2b$$10$$SHOt9G1qUNIvHoWre7499.eEtp5PtOII0daOQGNV.dhDEuPmOUdsq # Change this! Must be a bcrypt hash. Escape $ as $$ in docker-compose!
- TZ=Europe/Berlin # Timezone for daily puzzle rotation
- GOTIFY_URL=https://gotify.example.com
- GOTIFY_APP_TOKEN=your_gotify_token

View File

@@ -17,5 +17,8 @@ bcrypt.hash(password, saltRounds, (err, hash) => {
}
console.log('Plaintext:', password);
console.log('Bcrypt Hash:', hash);
console.log('\n⚠ IMPORTANT FOR DOCKER COMPOSE:');
console.log('If you use this hash directly in docker-compose.yml, you MUST escape the $ signs:');
console.log('Docker Hash:', hash.replace(/\$/g, '$$$$'));
console.log('\nSet this hash as your ADMIN_PASSWORD environment variable.');
});