about summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 4405674..1e7bd63 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,18 +1,22 @@
+use std::fs;
+
 use serde::{Deserialize, Serialize};
+use serde_yaml;
 
 const VERS: &str = "v0.1";
 const OUT_PATH: &str = "/var/www/htdocs/tilde.json";
+const CONF_PATH: &str = "instistats.yml";
 
 #[derive(Debug, Deserialize, Serialize)]
 struct Server {
     name: String,
     url: String,
     signup_url: String,
-    user_count: u32,
+    user_count: Option<u32>,
     want_users: bool,
     admin_email: String,
     description: String,
-    users: Vec<User>,
+    users: Option<Vec<User>>,
 }
 
 #[derive(Debug, Deserialize, Serialize)]
@@ -28,4 +32,10 @@ fn main() {
     println!();
     println!("Path: {}", OUT_PATH);
     println!();
+
+    let conf = fs::read_to_string(CONF_PATH).expect("Could not read config file");
+    let conf_yaml: Server =
+        serde_yaml::from_str(&conf).expect("Could not parse config data as YAML");
+
+    println!("{:#?}", conf_yaml);
 }