feat: generate config, load shell env vars
This commit is contained in:
+3
-13
@@ -1,4 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::{collections::HashMap, process};
|
||||
|
||||
use clap::ArgMatches;
|
||||
use reqwest::blocking::Client;
|
||||
@@ -56,17 +56,6 @@ impl<'a> Request<'a> {
|
||||
authentication: auth,
|
||||
}
|
||||
}
|
||||
|
||||
/// public method that decides whether to format the request url
|
||||
/// based on the authentication written in the config file.
|
||||
/// Returns an integer.
|
||||
pub fn url_request(&self) -> bool {
|
||||
if self.authentication.api_token {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Authentication {
|
||||
@@ -90,7 +79,8 @@ impl Authentication {
|
||||
basic_auth,
|
||||
)
|
||||
} else {
|
||||
panic!("Must have some form of authentication! Exiting...");
|
||||
println!("Must have some form of authentication! Exiting...");
|
||||
process::exit(3)
|
||||
}
|
||||
} else {
|
||||
Authentication::with_api_token(config.username.as_ref().unwrap().to_string(), api_auth)
|
||||
|
||||
Reference in New Issue
Block a user