#!/bin/sh
# Seed the data volume with the baked-in default JSON state on first run only.
# Existing files (e.g. your preserved pamiec.json history) are never overwritten.
set -e

DATA="${CONJURER_DATA_DIR:-/data}"
mkdir -p "$DATA"

for f in settings.json system_gpt_settings.json pamiec.json pamiec_muzyki.json accident_log.json; do
    if [ ! -e "$DATA/$f" ] && [ -e "/app/$f" ]; then
        cp "/app/$f" "$DATA/$f"
        echo "entrypoint: seeded $f into $DATA"
    fi
done

exec "$@"
