Made missing KV_URL env error more obvious
This commit is contained in:
parent
41d75a956c
commit
58df939280
@ -24,7 +24,7 @@ impl StreamSink {
|
|||||||
impl Sink for StreamSink {
|
impl Sink for StreamSink {
|
||||||
fn start(&mut self) -> SinkResult<()> {
|
fn start(&mut self) -> SinkResult<()> {
|
||||||
if let Err(_why) = self.sender.send(SinkEvent::Start) {
|
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()));
|
// return Err(SinkError::ConnectionRefused(_why.to_string()));
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ impl Sink for StreamSink {
|
|||||||
|
|
||||||
fn stop(&mut self) -> SinkResult<()> {
|
fn stop(&mut self) -> SinkResult<()> {
|
||||||
if let Err(_why) = self.sender.send(SinkEvent::Stop) {
|
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()));
|
// return Err(SinkError::ConnectionRefused(_why.to_string()));
|
||||||
}
|
}
|
||||||
|
@ -15,3 +15,7 @@ pub static SPOTIFY_CLIENT_SECRET: LazyLock<String> = LazyLock::new(|| {
|
|||||||
std::env::var("SPOTIFY_CLIENT_SECRET")
|
std::env::var("SPOTIFY_CLIENT_SECRET")
|
||||||
.expect("missing SPOTIFY_CLIENT_SECRET environment variable")
|
.expect("missing SPOTIFY_CLIENT_SECRET environment variable")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Locked behind `stats` feature
|
||||||
|
pub static KV_URL: LazyLock<String> =
|
||||||
|
LazyLock::new(|| std::env::var("KV_URL").expect("missing KV_URL environment variable"));
|
||||||
|
@ -31,6 +31,10 @@ pub fn link_url() -> &'static str {
|
|||||||
&env::LINK_URL
|
&env::LINK_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn kv_url() -> &'static str {
|
||||||
|
&env::KV_URL
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_spotify(token: Token) -> AuthCodeSpotify {
|
pub fn get_spotify(token: Token) -> AuthCodeSpotify {
|
||||||
AuthCodeSpotify::from_token_with_config(
|
AuthCodeSpotify::from_token_with_config(
|
||||||
token,
|
token,
|
||||||
|
@ -68,7 +68,7 @@ pub async fn setup(
|
|||||||
let manager = SessionManager::new(songbird, database);
|
let manager = SessionManager::new(songbird, database);
|
||||||
|
|
||||||
#[cfg(feature = "stats")]
|
#[cfg(feature = "stats")]
|
||||||
let stats = StatsManager::new(std::env::var("KV_URL")?)?;
|
let stats = StatsManager::new(spoticord_config::kv_url())?;
|
||||||
|
|
||||||
tokio::spawn(background_loop(
|
tokio::spawn(background_loop(
|
||||||
manager.clone(),
|
manager.clone(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user