commit 9167e0c837abd7a8a6ad4eed9c6c69852a648907 Author: Linus Vogel Date: Mon Aug 17 22:44:04 2026 +0200 initial commit. simple config structure diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c38e82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +.idea/ +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..13c0e95 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "keel" +version = "0.1.0" +edition = "2024" + + +[dependencies] +config = "0.15.25" +lfcm = { git = "https://gitea.linvogel.ch/linus/lfcm.git", tag = "v0.1.2" } diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..3b29e46 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,27 @@ + + +//* +config! { + param name = Config; + section top { + section server { + var host: String = String::from("localhost"); + var port: u16 = 5501; + } + section states { + section top { + var top_source: String = String::from("http"); + var top_path: String = String::from(""); + } + section sls { + var source: String = String::from("git"); + var sls_path: String = String::from(""); + section gitfs { + var user: String = String::from("git"); + var key: String = String::from("/root/id_ed25519"); + } + } + } + } +} +// */ diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..0a3dd23 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,24 @@ +#[macro_use] +extern crate lfcm; + +use crate::config::LFCMError; + +pub mod config; + +fn main() { + let config_res = crate::config::lfcm_load_config(vec![ + "/etc/keel/master.toml" + ]); + let config = match config_res { + Ok(config) => config, + Err(LFCMError::UnableToBuild) => { + println!("ERROR: Unable to build config from files. Do all necessary files exist?"); + return; + }, + Err(LFCMError::ParseError(x)) => { + println!("ERROR: Unable to parse config file: {}", x); + return + } + }; + +}