Replaced dotenv::var with std::env::var

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2021-10-19 23:04:43 +02:00
parent 567e750f73
commit 539bf51bab
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283
3 changed files with 7 additions and 7 deletions

View File

@ -6,9 +6,9 @@ use crate::body_to_str;
pub async fn get_albums(client: &Client<HttpsConnector<HttpConnector>>, lychee_session: HeaderValue) -> JsonValue {
let req = Request::builder()
.method(Method::POST)
.uri(dotenv::var("LYCHEE_ENDPOINT").unwrap() + "/api/Albums::get")
.uri(std::env::var("LYCHEE_ENDPOINT").unwrap() + "/api/Albums::get")
.header(COOKIE, lychee_session)
.header(AUTHORIZATION, dotenv::var("API_KEY").unwrap())
.header(AUTHORIZATION, std::env::var("API_KEY").unwrap())
.body(Body::empty())
.expect("error");
let _res = client.request(req).await.unwrap();

View File

@ -1,9 +1,9 @@
use hyper_tls::HttpsConnector;
use hyper::{Body, Client, Response};
use dotenv::dotenv;
use crate::session::login;
use crate::albums::get_albums;
use dotenv::dotenv;
mod session;
mod albums;

View File

@ -5,14 +5,14 @@ use crate::body_to_str;
pub async fn login(client: &Client<HttpsConnector<HttpConnector>>) -> HeaderValue {
let login_data = object! {
"username": dotenv::var("USERNAME").unwrap(),
"password": dotenv::var("PASSWORD").unwrap()
"username": std::env::var("USERNAME").unwrap(),
"password": std::env::var("PASSWORD").unwrap()
};
let req = Request::builder()
.method(Method::POST)
.uri(dotenv::var("LYCHEE_ENDPOINT").unwrap() + "/api/Session::login")
.header(AUTHORIZATION, dotenv::var("API_KEY").unwrap())
.uri(std::env::var("LYCHEE_ENDPOINT").unwrap() + "/api/Session::login")
.header(AUTHORIZATION, std::env::var("API_KEY").unwrap())
.header(CONTENT_TYPE, "application/json")
.body(Body::from(login_data.dump()))
.expect("error");