Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/pulse/radar_store.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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} ->
Expand Down
Loading