diff --git a/lib/pulse/radar_store.ex b/lib/pulse/radar_store.ex index 0de101e..26ea24f 100644 --- a/lib/pulse/radar_store.ex +++ b/lib/pulse/radar_store.ex @@ -51,8 +51,13 @@ defmodule Pulse.RadarStore do @impl true def init(_opts) do - path = Path.join(:code.priv_dir(:pulse), "data/radars.dets") |> to_charlist() - File.mkdir_p!(Path.dirname(to_string(path))) + # Read from the configurable data_dir (overridden in prod via DATA_DIR + # → /app/data, a Kamal-mounted volume). Matches Pulse.Store / Analytics + # / RadarAnalytics — using :code.priv_dir/1 here meant every deploy + # wiped the file because release dirs are rebuilt per image. + data_dir = Application.get_env(:pulse, :data_dir, "priv/data") + File.mkdir_p!(data_dir) + path = Path.join(data_dir, "radars.dets") |> String.to_charlist() case :dets.open_file(@table, file: path, type: :set) do {:ok, table} ->