Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entropy-tss application data is stored in current working directory #1197

Open
ameba23 opened this issue Dec 4, 2024 · 0 comments
Open

entropy-tss application data is stored in current working directory #1197

ameba23 opened this issue Dec 4, 2024 · 0 comments

Comments

@ameba23
Copy link
Contributor

ameba23 commented Dec 4, 2024

The directory where the key-value database is stored for entropy-tss is determined by the function entropy_kvdb::get_db_path:

pub fn get_db_path(testing: bool) -> String {

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 as microxdg).

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).

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Entropy Core Dec 4, 2024
@ameba23 ameba23 changed the title entropy-tss application data is stored in current working directory in which binary is run entropy-tss application data is stored in current working directory Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant