diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 11f9d444..321da2b3 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,15 +1,12 @@ #!/bin/sh -# Copy example config if no config.json exists (check volume mount first) -if [ ! -f /app/data/config.json ]; then - echo "[entrypoint] No config.json found in /app/data/, copying example" - cp /app/config.example.json /app/data/config.json +# Copy example config if no config.json exists at app root (not bind-mounted) +if [ ! -f /app/config.json ]; then + echo "[entrypoint] No config.json found, copying from config.example.json" + cp /app/config.example.json /app/config.json fi -# Symlink so the app finds it at /app/config.json -ln -sf /app/data/config.json /app/config.json - -# Same for theme.json (optional) +# theme.json: check data/ volume (admin-editable on host) if [ -f /app/data/theme.json ]; then ln -sf /app/data/theme.json /app/theme.json fi diff --git a/server.js b/server.js index 03931035..b0f81be4 100644 --- a/server.js +++ b/server.js @@ -7,10 +7,10 @@ const { WebSocketServer } = require('ws'); const mqtt = require('mqtt'); const path = require('path'); const fs = require('fs'); -// Config: checks data/ dir first (Docker volume), then app dir +// Config: bind-mounted config.json first, then fall back to data/ dir const CONFIG_PATHS = [ - path.join(__dirname, 'data', 'config.json'), - path.join(__dirname, 'config.json') + path.join(__dirname, 'config.json'), + path.join(__dirname, 'data', 'config.json') ]; function loadConfigFile() { for (const p of CONFIG_PATHS) {