mirror of
https://git.alemi.dev/tci.git
synced 2024-11-23 16:44:48 +01:00
alemi
7e1fd5fe3e
no .tci dir! no .tci.toml! just one tci script, keep your scripts in your repo and start them from .tci with bash tasks, instead of reinventing the wheel with configs and conditions i should pre-parse as many info as possible and provide to the underlying .tci script
23 lines
489 B
Rust
23 lines
489 B
Rust
#[derive(Debug, Default, serde::Deserialize)]
|
|
pub struct TciConfig {
|
|
#[serde(default)]
|
|
pub allow_all: bool,
|
|
|
|
#[serde(default)]
|
|
pub branch: Option<String>,
|
|
|
|
#[serde(default)]
|
|
pub hooks: Vec<String>,
|
|
}
|
|
|
|
impl TciConfig {
|
|
pub fn load() -> Result<Self, toml::de::Error> {
|
|
let config_path = std::env::var("TCI_CONFIG")
|
|
.unwrap_or_else(|_| "/etc/tci/config.toml".into());
|
|
|
|
let cfg_raw = std::fs::read_to_string(config_path)
|
|
.unwrap_or_default();
|
|
|
|
toml::from_str(&cfg_raw)
|
|
}
|
|
}
|