Skip to content

Commit

Permalink
Refactor file path for user data storage in InMemoryDB to relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
odysseus0 committed Dec 12, 2024
1 parent e7d484c commit 6b8ff07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl TeleportDB for InMemoryDB {
}

fn add_user(&mut self, address: String, user: User) -> eyre::Result<()> {
let file_path = Path::new("/root/shared/users").join(format!("{}.user", address));
let file_path = Path::new("shared/users").join(format!("{}.user", address));
log::info!("Saving user to file: {:?}", file_path.clone());
let mut file = File::create(file_path)?;
let contents = serde_json::to_string(&user)?;
Expand All @@ -52,7 +52,7 @@ impl TeleportDB for InMemoryDB {
}

fn get_user_by_address(&self, address: String) -> eyre::Result<User> {
let file_path = Path::new("/root/shared/users").join(format!("{}.user", address));
let file_path = Path::new("shared/users").join(format!("{}.user", address));
let contents = read_to_string(file_path)?;
let user: User = serde_json::from_str(&contents)?;
Ok(user.clone())
Expand Down

0 comments on commit 6b8ff07

Please sign in to comment.