Move listenbrainz user to env var
This commit is contained in:
@ -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!(
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user