Skip to content

Commit

Permalink
fixed the connectum env detection being incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Aug 8, 2024
1 parent 24529c2 commit 7ec06cf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions server/src/calendar/refresh.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::env;
use std::time::Duration;

use futures::stream::FuturesUnordered;
Expand Down Expand Up @@ -44,12 +45,20 @@ LIMIT 30"#)

#[tracing::instrument(skip(pool))]
pub async fn all_entries(pool: &PgPool) {
if let Err(e) = std::env::var("CONNECTUM_OAUTH_CLIENT_ID") {
error!("Please make sure that CONNECTUM_OAUTH_CLIENT_ID are valid to use calendar features: {e:?}");
let client_id_invalid = match env::var("CONNECTUM_OAUTH_CLIENT_ID") {
Err(_) => true,
Ok(s) => s.trim().is_empty(),
};
if client_id_invalid {
error!("cannot get environment variable CONNECTUM_OAUTH_CLIENT_ID, nessesary to refresh all calendars");
return;
}
if let Err(e) = std::env::var("CONNECTUM_OAUTH_CLIENT_SECRET") {
error!("Please make sure that CONNECTUM_OAUTH_CLIENT_SECRET is valid to use calendar features: {e:?}");
let client_secret_invalid = match env::var("CONNECTUM_OAUTH_CLIENT_SECRET") {
Err(_) => true,
Ok(s) => s.trim().is_empty(),
};
if client_secret_invalid {
error!("cannot get environment variable CONNECTUM_OAUTH_CLIENT_SECRET, nessesary to refresh all calendars");
return;
}

Expand Down

0 comments on commit 7ec06cf

Please sign in to comment.