From 6b4f055c36b5493242d019058e62657fb4abf10f Mon Sep 17 00:00:00 2001 From: cloudhead Date: Wed, 21 Feb 2024 16:54:02 +0100 Subject: [PATCH] cli: Don't allow missing config file It's best to just error if the user is missing the config file, since we create it on profile init. This also gets rid of the privacy leak. --- radicle/src/profile.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/radicle/src/profile.rs b/radicle/src/profile.rs index bf6a12ad..6ced615c 100644 --- a/radicle/src/profile.rs +++ b/radicle/src/profile.rs @@ -12,7 +12,7 @@ //! use std::io::Write; use std::path::{Path, PathBuf}; -use std::{fs, io, str::FromStr}; +use std::{fs, io}; use serde::Serialize; use thiserror::Error; @@ -163,15 +163,7 @@ impl Config { Ok(cfg) => { serde_json::from_reader(cfg).map_err(|e| ConfigError::Load(path.to_path_buf(), e)) } - Err(e) => { - let Ok(user) = env::var("USER") else { - return Err(ConfigError::Io(path.to_owned(), e)); - }; - let Ok(alias) = Alias::from_str(&user) else { - return Err(ConfigError::Io(path.to_owned(), e)); - }; - Ok(Config::new(alias)) - } + Err(e) => Err(ConfigError::Io(path.to_path_buf(), e)), } }