about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rwxr-xr-xsrc/main.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index b2ac1e9..6d0f27e 100755
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,6 +52,7 @@ use crate::{
 
 #[derive(Clone)]
 pub struct AwakeState {
+	pub do_statistics: bool,
 	pub database: Arc<Database>,
 	pub cache_path: Utf8PathBuf,
 	pub netinfo_upper_bound: Arc<AtomicUsize>,
@@ -81,6 +82,10 @@ async fn main() {
 	let hostname = conf.child_owned("Hostname").unwrap();
 	let dbpath = conf.child_owned("Database").unwrap();
 	let cache = conf.child_owned("Cache").unwrap();
+	let statistics = match conf.child_value("Statistics") {
+		None | Some("true") | Some("yes") | Some("collect") => true,
+		_ => false,
+	};
 
 	let database = Database::new(dbpath.into());
 	database.create_tables();
@@ -88,6 +93,7 @@ async fn main() {
 	let fs = Filesystem::new(&webroot);
 
 	let state = AwakeState {
+		do_statistics: statistics,
 		database: Arc::new(database),
 		cache_path: cache.into(),
 		netinfo_upper_bound: Arc::new(AtomicUsize::new(256)),
@@ -101,13 +107,8 @@ async fn main() {
 	}
 
 	let mut gatherer = Gatherer::new(state.clone());
-
-	#[cfg(target_os = "linux")]
 	gatherer.start();
 
-	#[cfg(not(target_os = "linux"))]
-	tracing::warn!("compilation target was not linux; not collecing stat data");
-
 	let settings = Settings {
 		template_dir: Utf8PathBuf::from(webroot.join(templates))
 			.canonicalize_utf8()