From 669c38a8faf6314229ded1ddcde5032c47c25856 Mon Sep 17 00:00:00 2001 From: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:08:17 +0200 Subject: [PATCH] Scope password stricter and less mut --- integration/main.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/integration/main.rs b/integration/main.rs index edba18e..652f993 100644 --- a/integration/main.rs +++ b/integration/main.rs @@ -30,11 +30,17 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); async fn main() -> Result<(), anyhow::Error> { dotenv::dotenv().map_err(|e|Error::DotenvInitError(e))?; let username = dotenv::var("USERNAME").map_err(|e|Error::NoUsername(e))?; - let password = dotenv::var("PASSWORD").map_err(|e|Error::NoPassword(e))?; - let mut client = vrchatapi::apis::configuration::Configuration::default(); - client.user_agent = Some(format!("vrchatapi-rust@{VERSION} https://github.com/vrchatapi/vrchatapi-rust/issues/new")); - client.basic_auth = Some((username.clone(), Some(password))); + let client = { + let password = dotenv::var("PASSWORD").map_err(|e|Error::NoPassword(e))?; + + let mut client = vrchatapi::apis::configuration::Configuration::default(); + client.user_agent = Some(format!("vrchatapi-rust@{VERSION} https://github.com/vrchatapi/vrchatapi-rust/issues/new")); + client.basic_auth = Some((username.clone(), Some(password))); + + client + }; + let u = login(&client, &username).await?; logout(&client).await?;