Move listenbrainz user to env var

This commit is contained in:
jude
2023-09-09 20:48:46 +01:00
parent 9c689d73d6
commit 5ff56d8396
3 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,5 @@
use serde::Deserialize;
use std::fmt::Display;
const BASE: &'static str = "https://api.listenbrainz.org/1";
@ -74,7 +75,7 @@ pub struct RecordingsEntry {
}
pub async fn recordings(
user: &str,
user: impl Display,
range: StatsRange,
) -> Result<RecordingsPayload, reqwest::Error> {
let url = format!(

View File

@ -61,7 +61,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
async fn index(State(pool): State<PgPool>) -> String {
let response = listenbrainz::recordings("jellywx", StatsRange::Week)
let response = listenbrainz::recordings(env::var("LISTENBRAINZ_USER")?, StatsRange::Week)
.await
.unwrap();