Context
Default path for persistency : "./state" is defined in PersistConfig at detector.py:26.
The problem:
This is a relative path, resolved against the process's current working directory.
When running as a systemd service, the CWD is typically / (unless WorkingDirectory= is set in the unit file).
default ./state would resolve to /state which is unlikely to exist and requires root to create (and probabla not where we want state files?)
init_persistency appends the detector name -> a detector named MyDetector with the default path writes to ./state/MyDetector/
There's no environment-aware default. The path is always whatever the caller configures (or "./state" if not set). For a systemd deployment we would need to:
Configure for example persist=PersistConfig(path="/var/lib/detectmate/state") explicitly (absolute path that works regardless of CWD)
Alternatives
Set for example WorkingDirectory=/var/lib/detectmate (or similar) in the unit file if used as system d service
--> then this should be pointed out clearly in the documentation
If the feature request is approved, would you be willing to submit a PR?
Yes
Context
Default path for persistency : "./state" is defined in PersistConfig at detector.py:26.
The problem:
This is a relative path, resolved against the process's current working directory.
When running as a systemd service, the CWD is typically
/(unlessWorkingDirectory=is set in the unit file).default ./state would resolve to /state which is unlikely to exist and requires root to create (and probabla not where we want state files?)
init_persistency appends the detector name -> a detector named MyDetector with the default path writes to ./state/MyDetector/
There's no environment-aware default. The path is always whatever the caller configures (or "./state" if not set). For a systemd deployment we would need to:
Configure for example persist=PersistConfig(path="/var/lib/detectmate/state") explicitly (absolute path that works regardless of CWD)
Alternatives
Set for example WorkingDirectory=/var/lib/detectmate (or similar) in the unit file if used as system d service
--> then this should be pointed out clearly in the documentation
If the feature request is approved, would you be willing to submit a PR?
Yes