Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unwraps in Client #12

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions crates/infisical/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ pub struct Client {

impl Client {
pub fn new(settings_input: Option<ClientSettings>) -> Self {
let settings = settings_input.unwrap();

let settings = settings_input.unwrap();
let c = Self {
auth: ClientAuth {
client_id: settings.client_id.unwrap_or("".to_string()),
Expand All @@ -34,7 +33,7 @@ impl Client {

cache: Arc::new(Mutex::new(Vec::new())),
cache_ttl: settings.cache_ttl.unwrap_or(300),
user_agent: settings.user_agent.unwrap(),
user_agent: settings.user_agent.unwrap_or("".to_string()),
};

if c.cache_ttl != 0 {
Expand All @@ -43,12 +42,6 @@ impl Client {
return c;
}

pub fn set_cache(&self, new_cache: &[CachedSecret]) {
let mut cache = self.cache.lock().unwrap();
cache.clear();
cache.extend(new_cache.iter().cloned());
}

pub fn set_access_token(&mut self, token: String) {
self.auth.access_token = Some(token);
}
Expand Down
Loading