Replaced dotenv::var with std::env::var
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
567e750f73
commit
539bf51bab
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user