initial commit. simple config structure

This commit is contained in:
Linus Vogel 2026-08-17 22:44:04 +02:00
commit 9167e0c837
4 changed files with 63 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/target
.idea/
Cargo.lock

9
Cargo.toml Normal file
View File

@ -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" }

27
src/config.rs Normal file
View File

@ -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");
}
}
}
}
}
// */

24
src/main.rs Normal file
View File

@ -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
}
};
}