aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..29145b8
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,27 @@
+use serde::Deserialize;
+use std::path::PathBuf;
+
+#[derive(Deserialize, Debug)]
+pub struct Config {
+ pub to: String,
+ pub from: String,
+ pub account_sid: String,
+ pub auth_token: String,
+ pub reboot: RebootConfig,
+ pub hello: HelloConfig,
+}
+
+#[derive(Deserialize, Debug)]
+pub struct RebootConfig {
+ pub ifname: String,
+}
+
+#[derive(Deserialize, Debug)]
+pub struct HelloConfig {}
+
+impl Config {
+ pub fn load_from_file(filename: &PathBuf) -> std::io::Result<Config> {
+ let content = std::fs::read_to_string(filename)?;
+ Ok(toml::from_str(&content)?)
+ }
+}