summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..0c9c35c
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,23 @@
+use log::trace;
+use serde::{Deserialize, Serialize};
+use std::fs::File;
+use std::path::{Path, PathBuf};
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct Config {
+ pub worker_image: PathBuf,
+ pub source: PathBuf,
+ pub workspace: Option<PathBuf>,
+ pub ansible: serde_yaml::Value,
+ pub build: String,
+}
+
+impl Config {
+ pub fn read(filename: &Path) -> anyhow::Result<Self> {
+ trace!("filename={:?}", filename);
+ let file = File::open(filename)?;
+ let config: Config = serde_yaml::from_reader(file)?;
+ Ok(config)
+ }
+}