From 0aa81b8bd6ac30fcdb03931932dff93aa8a85900 Mon Sep 17 00:00:00 2001 From: lostb1t Date: Sat, 13 Jul 2024 09:50:56 +0200 Subject: [PATCH] fix: add warning for missing plex token --- Makefile | 2 +- src/main.rs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b2107ae..f2aa302 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ run: REPLEX_DISABLE_USER_STATE=0 \ REPLEX_ENABLE_CONSOLE=0 \ REPLEX_CACHE_TTL=600 \ - REPLEX_NTF_WATCHLIST_FORCE=1 \ RUST_LOG="info,replex=info" \ + REPLEX_NTF_WATCHLIST_FORCE=1 \ RUSTFLAGS=-Awarnings \ cargo watch -w src -x run diff --git a/src/main.rs b/src/main.rs index aef6292..f6ae337 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,11 +15,7 @@ use tracing_subscriber::prelude::*; #[tokio::main] async fn main() { let config: Config = Config::figment().extract().unwrap(); - if config.host.is_none() { - tracing::error!("REPLEX_HOST is required. Exiting"); - return; - } - + // set default log level if let Err(i) = env::var("RUST_LOG") { env::set_var("RUST_LOG", "info") @@ -62,6 +58,14 @@ async fn main() { // .with(otlp_layer) .with(fmt_layer) .init(); + + if config.host.is_none() { + tracing::error!("REPLEX_HOST is required. Exiting"); + return; + } + if config.token.is_none() { + tracing::warn!("REPLEX_TOKEN not defined. Hero art might not load correctly."); + } // spawn our background task // let mut plex_client = PlexClient::dummy();