use anyhow::Result; use askama::Template; use std::fs; pub mod api; pub mod config; pub mod db; pub mod gritea_ext; pub mod templates; pub mod worker; pub use config::CONFIG; pub const ASCII_LOGO: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/logo.txt")); pub fn init() -> Result<()> { println!("{}\n", ASCII_LOGO); CONFIG.validate()?; Ok(()) } pub fn init_nginx() -> Result<()> { let config = templates::NginxConfig { domain_segments: CONFIG.domain.split('.').collect(), } .render()?; log::info!("Updating Nginx config"); fs::write( format!("{}/gitea_pages.conf", CONFIG.nginx_config_dir), config, )?; Ok(()) }