You've already forked Atomcms-edit
fix: preserve catalog icon URLs after Nitro-V3 update
- Add Fase 3 to sync merged configs to dist/configuration/ - Add Fase 4 to force critical URLs (image.library.url, hof.furni.url, etc.) - Add NITRO_* env vars with current server defaults - Prevent git pull from overwriting icon URL config with example values
This commit is contained in:
@@ -36,6 +36,15 @@ BACKUP_DIR="${NITRO_BACKUP_DIR:-$EMULATOR_DIR/Database Updates/backups}"
|
||||
NITRO_CLIENT="${NITRO_CLIENT_SRC:-/var/www/Nitro-V3}"
|
||||
NITRO_RENDERER="${NITRO_RENDERER_SRC:-/var/www/Nitro_Render_V3}"
|
||||
|
||||
# Kritieke URLs voor catalog icons (uit env, met huidige server defaults)
|
||||
NITRO_IMAGE_LIBRARY_URL="${NITRO_IMAGE_LIBRARY_URL:-https://epicnabbo.nl/gamedata/c_images/}"
|
||||
NITRO_HOF_FURNITURE_URL="${NITRO_HOF_FURNITURE_URL:-https://epicnabbo.nl/gamedata/icons}"
|
||||
NITRO_API_URL="${NITRO_API_URL:-https://ws.epicnabbo.nl}"
|
||||
NITRO_SOCKET_URL="${NITRO_SOCKET_URL:-wss://ws.epicnabbo.nl}"
|
||||
NITRO_CAMERA_URL="${NITRO_CAMERA_URL:-http://epicnabbo.nl/camera/photo/}"
|
||||
NITRO_GAMEDATA_URL="${NITRO_GAMEDATA_URL:-https://epicnabbo.nl/gamedata}"
|
||||
NITRO_ASSET_URL="${NITRO_ASSET_URL:-https://epicnabbo.nl/gamedata/bundled}"
|
||||
|
||||
# Build MySQL/MariaDB credentials argument
|
||||
MYSQL_CRED="-h $DB_HOST -P $DB_PORT -u $DB_USER"
|
||||
if [ -n "$DB_PASS" ]; then
|
||||
@@ -171,6 +180,63 @@ for example_file in "$NITRO_SRC_DIR"/*.example; do
|
||||
node "$MERGE_SCRIPT" "$example_file" "$target_path"
|
||||
done
|
||||
|
||||
# Fase 3: Sync de gemergde configs naar dist/configuration voor de live client
|
||||
NITRO_DIST_CONFIG_DIR="$NITRO_CLIENT/dist/configuration"
|
||||
if [ -d "$NITRO_DIST_CONFIG_DIR" ]; then
|
||||
echo "--> Syncing merged configs to dist/configuration/..."
|
||||
for example_file in "$NITRO_SRC_DIR"/*.example; do
|
||||
[ -f "$example_file" ] || continue
|
||||
base=$(basename "$example_file")
|
||||
target_name="${base%.example}"
|
||||
case "$target_name" in
|
||||
*.*) ;;
|
||||
*) target_name="$target_name.json" ;;
|
||||
esac
|
||||
if [ -f "$NITRO_SRC_DIR/$target_name" ]; then
|
||||
cp "$NITRO_SRC_DIR/$target_name" "$NITRO_DIST_CONFIG_DIR/$target_name"
|
||||
echo "--> [OK] Synced $target_name to dist/configuration/"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Fase 4: Herstel kritieke icon URLs in renderer-config en ui-config
|
||||
# (voorkomt dat git pull de URLs overschrijft met voorbeeldwaarden)
|
||||
echo "--> Ensuring critical catalog icon URLs are correct..."
|
||||
FORCE_CONFIG_SCRIPT=$(cat << 'PYEOF'
|
||||
import json, sys, os
|
||||
|
||||
paths = [
|
||||
os.path.join(os.environ.get('NITRO_SRC_DIR', ''), 'renderer-config.json'),
|
||||
os.path.join(os.environ.get('NITRO_DIST_CONFIG_DIR', ''), 'renderer-config.json'),
|
||||
]
|
||||
|
||||
for path in paths:
|
||||
if not os.path.exists(path):
|
||||
continue
|
||||
with open(path, 'r') as f:
|
||||
data = json.load(f)
|
||||
for key in ['image.library.url', 'hof.furni.url', 'gamedata.url', 'asset.url']:
|
||||
env_val = os.environ.get(f'NITRO_{key.upper().replace(".", "_")}')
|
||||
if env_val:
|
||||
data[key] = env_val
|
||||
for key in ['api.url', 'socket.url']:
|
||||
if key in data:
|
||||
env_val = os.environ.get(f'NITRO_{key.upper().replace(".", "_")}')
|
||||
if env_val:
|
||||
data[key] = env_val
|
||||
with open(path, 'w') as f:
|
||||
json.dump(data, f, indent=(4 if 'dist' not in path else None), separators=(',', ':') if 'dist' in path else (',', ': '))
|
||||
print(f'--> [OK] Hersteld: {os.path.basename(path)}')
|
||||
|
||||
print('--> [OK] Catalog icon URLs zijn correct ingesteld')
|
||||
PYEOF
|
||||
)
|
||||
cd "$NITRO_CLIENT" && NITRO_SRC_DIR="$NITRO_SRC_DIR" NITRO_DIST_CONFIG_DIR="$NITRO_DIST_CONFIG_DIR" \
|
||||
NITRO_IMAGE_LIBRARY_URL="$NITRO_IMAGE_LIBRARY_URL" NITRO_HOF_FURNITURE_URL="$NITRO_HOF_FURNITURE_URL" \
|
||||
NITRO_API_URL="$NITRO_API_URL" NITRO_SOCKET_URL="$NITRO_SOCKET_URL" \
|
||||
NITRO_GAMEDATA_URL="$NITRO_GAMEDATA_URL" NITRO_ASSET_URL="$NITRO_ASSET_URL" \
|
||||
python3 -c "$FORCE_CONFIG_SCRIPT"
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
# 5. Automated Cleanup (Logs & Backups)
|
||||
|
||||
Reference in New Issue
Block a user