diff options
Diffstat (limited to 'tools/sendsms/src/config.rs')
-rw-r--r-- | tools/sendsms/src/config.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/sendsms/src/config.rs b/tools/sendsms/src/config.rs new file mode 100644 index 0000000..da9435a --- /dev/null +++ b/tools/sendsms/src/config.rs @@ -0,0 +1,23 @@ +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, +} + +#[derive(Deserialize, Debug)] +pub struct RebootConfig { + pub ifname: String, +} + +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)?) + } +} |