From b0caae8081007c9b97d550c47111c417e579f859 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 18 Apr 2025 02:14:15 +0200 Subject: [PATCH] Make interval configurable --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a773294..a286147 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use std::time::Duration; use authelia_controller::context::Context; use authelia_controller::resources::AccessControlRule; +use color_eyre::eyre::Context as _; use dotenvy::dotenv; use futures_util::{StreamExt as _, TryStreamExt as _}; use kube::runtime::reflector::{self}; @@ -30,6 +31,13 @@ async fn main() -> color_eyre::Result<()> { let namespace = std::env::var("AUTHELIA_NAMESPACE").unwrap_or("authelia".into()); let deployment = std::env::var("AUTHELIA_DEPLOYMENT").unwrap_or("authelia".into()); let secret = std::env::var("AUTHELIA_SECRET").unwrap_or("authelia-acl".into()); + let interval = std::env::var("INTERVAL") + .map(|interval| { + interval + .parse() + .wrap_err_with(|| format!("INTERVAL={interval}")) + }) + .unwrap_or(Ok(15))?; info!("Starting"); @@ -53,7 +61,6 @@ async fn main() -> color_eyre::Result<()> { secret, )); - let interval = 15; tokio::spawn(async move { reader.wait_until_ready().await.unwrap(); loop {