diff --git a/spoticord_audio/src/sink.rs b/spoticord_audio/src/sink.rs index 23187e9..b11fb67 100644 --- a/spoticord_audio/src/sink.rs +++ b/spoticord_audio/src/sink.rs @@ -24,7 +24,7 @@ impl StreamSink { impl Sink for StreamSink { fn start(&mut self) -> SinkResult<()> { if let Err(_why) = self.sender.send(SinkEvent::Start) { - // WARNING: Returning an error causes librespot-playback to exit the process with status 1 + // WARNING: Returning an error causes librespot-playback to panic // return Err(SinkError::ConnectionRefused(_why.to_string())); } @@ -34,7 +34,7 @@ impl Sink for StreamSink { fn stop(&mut self) -> SinkResult<()> { if let Err(_why) = self.sender.send(SinkEvent::Stop) { - // WARNING: Returning an error causes librespot-playback to exit the process with status 1 + // WARNING: Returning an error causes librespot-playback to panic // return Err(SinkError::ConnectionRefused(_why.to_string())); } diff --git a/spoticord_config/src/env.rs b/spoticord_config/src/env.rs index 651bde9..53ad0c1 100644 --- a/spoticord_config/src/env.rs +++ b/spoticord_config/src/env.rs @@ -15,3 +15,7 @@ pub static SPOTIFY_CLIENT_SECRET: LazyLock = LazyLock::new(|| { std::env::var("SPOTIFY_CLIENT_SECRET") .expect("missing SPOTIFY_CLIENT_SECRET environment variable") }); + +// Locked behind `stats` feature +pub static KV_URL: LazyLock = + LazyLock::new(|| std::env::var("KV_URL").expect("missing KV_URL environment variable")); diff --git a/spoticord_config/src/lib.rs b/spoticord_config/src/lib.rs index e711e0f..dcba7c0 100644 --- a/spoticord_config/src/lib.rs +++ b/spoticord_config/src/lib.rs @@ -31,6 +31,10 @@ pub fn link_url() -> &'static str { &env::LINK_URL } +pub fn kv_url() -> &'static str { + &env::KV_URL +} + pub fn get_spotify(token: Token) -> AuthCodeSpotify { AuthCodeSpotify::from_token_with_config( token, diff --git a/src/bot.rs b/src/bot.rs index d48c360..d587b4d 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -68,7 +68,7 @@ pub async fn setup( let manager = SessionManager::new(songbird, database); #[cfg(feature = "stats")] - let stats = StatsManager::new(std::env::var("KV_URL")?)?; + let stats = StatsManager::new(spoticord_config::kv_url())?; tokio::spawn(background_loop( manager.clone(),