mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-05-25 12:14:04 +00:00
fix: config.json load order — bind-mount first, data/ fallback
Broke MQTT by reading example config from data/ instead of the real bind-mounted /app/config.json. Now checks app dir first.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user