entropy-tss
application data is stored in current working directory
#1197
Labels
entropy-tss
application data is stored in current working directory
#1197
The directory where the key-value database is stored for
entropy-tss
is determined by the functionentropy_kvdb::get_db_path
:entropy-core/crates/kvdb/src/lib.rs
Line 21 in 3df5d39
It calls
std::env::current_dir
to get the current working directory, then adds.entropy/production/db
or.entropy/testing/db
.Usually when i run entropy-tss from the command line this is fine - it creates a
.entropy
in whatever directory i am in, and i can easily clean it up afterwards.However recently when setting it up to run continuously in a VM enclave using a systemd service, it took me a while to figure out where the db was being stored as the process was being started by systemd, not my personal user.
The files end up in the root directory (
/.entropy
). This is not a conventional place to put a hidden directory containing application data.I don't know about other platforms but i think for linux the convention is to put writable system-wide application data in
/var/lib/<application name>
or/etc/<application name>
and user application data should follow the XDG base directory specification (eg: with a crate such asmicroxdg
).My proposal would be that if the
production
feature flag is present, we should attempt to use either/etc/entropy
or/var/lib/entropy
, and if we get a permissions error fall back to either the current working directory, or XDG directory (~/.local/share/entropy
or~/.local/state/entropy
).The text was updated successfully, but these errors were encountered: