bulletin_tools/bulletin-shared/src/config.rs
Benjamin Slingo 1eb1fc9909 Initial commit with major improvements
- Fixed Sabbath School parser to handle API data with extra line breaks
- Cleaned up project structure and removed nested directories
- Organized output to single directory structure
- Removed YouTube link from contact section for cleaner layout
- Improved parser robustness for multi-line content between labels
- Added proper .gitignore for Rust project
2025-08-21 20:17:54 -04:00

24 lines
771 B
Rust

use serde::{Deserialize, Serialize};
use std::path::Path;
use anyhow::Result;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Config {
pub church_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_phone: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_website: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_youtube: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contact_address: Option<String>,
}
impl Config {
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self> {
let content = std::fs::read_to_string(path)?;
let config: Config = toml::from_str(&content)?;
Ok(config)
}
}