aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-23 22:30:43 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-23 23:10:58 -0400
commitf82345336c1edad86420b3b61ebb8578eb495a3e (patch)
tree9f6da04b1c6ab69680916fc7d028a002d30ac203 /src/config.rs
parentae16ddeb2adc33b1ec23abfae29a553c920d8af4 (diff)
downloadrbw-f82345336c1edad86420b3b61ebb8578eb495a3e.tar.gz
rbw-f82345336c1edad86420b3b61ebb8578eb495a3e.zip
give a more useful error if rbw is misconfigured
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 39044c0..6c6c761 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -70,6 +70,14 @@ impl Config {
Ok(())
}
+ pub fn validate() -> Result<()> {
+ let config = Self::load()?;
+ if config.email.is_none() {
+ return Err(Error::ConfigMissingEmail);
+ }
+ Ok(())
+ }
+
pub fn base_url(&self) -> String {
self.base_url.clone().map_or_else(
|| "https://api.bitwarden.com".to_string(),