You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.5 KiB

use super::*;
use std::{
str,
fmt,
path::{
PathBuf,
Path,
},
};
mod parse;
mod format;
pub use format::*;
mod error;
pub use error::*;
mod job;
pub use job::*;
mod global;
pub use global::*;
/// Parse a single config file
#[inline]
pub async fn parse_global_single(path: impl AsRef<Path>) -> Result<Config, error::Error>
{
let mut cfg = Config::default();
parse::global(&mut cfg, path).await?;
Ok(cfg)
}
/// Re-exporting `build/config.toml`
#[allow(unused_imports)]
mod build_cfg;
pub mod build
{
use super::build_cfg::*;
use crate::static_assert;
/// Config for hotreload module `hot`
pub mod hot {
pub use super::*;
/// `GLOBAL_BACKLOG`
pub const BACKLOG: usize = CONFIG.hot.backlog as usize;
/// `GLOBAL_TIMEOUT`
pub const TIMEOUT: u64 = CONFIG.hot.timeout as u64;
static_assert!(BACKLOG > 0);
static_assert!(TIMEOUT > 0);
}
pub mod log
{
pub use super::*;
pub const DEFAULT_LOCAL_TIME: bool = CONFIG.log.default_time_local;
pub const DATE_FORMAT: std::borrow::Cow<'static, str> = CONFIG.log.date_format;
}
/// Print the status of `build.toml` vars
#[cfg(any(debug_assertions,feature="debug_logger"))]
pub fn stat()
{
use crate::status;
status!("Static options:");
status!(" hot::BACKLOG = {}", hot::BACKLOG);
status!(" hot::TIMEOUT = {}", hot::TIMEOUT);
}
/// Print the status of `build.toml` vars
#[cfg(not(any(debug_assertions,feature="debug_logger")))]
#[inline]
pub const fn stat(){}
}