NodeStore
Persists node approval state across restarts. New nodes reported by Netdata must be explicitly approved before they appear in the node dropdown.
The file is a best-effort mirror of in-memory state: if it cannot be written (read-only path, wrong owner) approvals still work for the life of the process and the dashboard keeps serving — they just will not survive a restart. Losing persistence must never take /nodes down with it.
Constants
PATH = (
ENV["ODASH_NODES_STORE"]? ||
ENV["STATE_DIRECTORY"]?.try do |d| File.join((d.split(':')).first, "nodes.json") end
) ||
"/var/lib/netdata-odash/nodes.json"
Default under systemd's StateDirectory=netdata-odash, which systemd creates with the right ownership. A CWD-relative default is wrong for a service: systemd runs with WorkingDirectory=/.
Class methods
On first run, grandfather in every currently-connected node as approved so existing nodes don't disappear from the dropdown.