compile write_user_id only when the analytics are enabled

This commit is contained in:
Tamo 2021-10-26 13:16:05 +02:00 committed by marin postma
parent c752c14c46
commit 10de92987a
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9
1 changed files with 1 additions and 0 deletions

View File

@ -32,6 +32,7 @@ fn find_user_id(db_path: &Path) -> Option<String> {
.or_else(|| fs::read_to_string(&config_user_id_path(db_path)?).ok())
}
#[cfg(all(not(debug_assertions), feature = "analytics"))]
/// Write the user-id in the `data.ms` and in `~/.config/MeiliSearch/path-to-db-user-id`. Ignore the errors.
fn write_user_id(db_path: &Path, user_id: &str) {
let _ = fs::write(db_path.join("user-id"), user_id.as_bytes());