feat: Create config module

This commit is contained in:
Nathan McCarty 2023-03-15 20:14:39 -04:00
parent 76744c00d4
commit 68ccc95345
No known key found for this signature in database
2 changed files with 39 additions and 1 deletions

View File

@ -1,4 +1,12 @@
//! Management of on-disk layout of the source of a site
use self::config::Config;
pub mod config;
/// Representation of the on-disk structure of a site
pub struct Site {}
#[derive(Debug)]
pub struct Site {
/// Top level configuration
pub config: Config,
}

30
src/site/config.rs Normal file
View File

@ -0,0 +1,30 @@
//! Configuration for a site
use serde::{Deserialize, Serialize};
/// Description of the domain name and related settings for a site
#[derive(Serialize, Deserialize, Debug)]
pub struct Domain {
/// The domain name itself
pub domain_name: String,
/// Should https be used
pub https: bool,
}
impl Default for Domain {
fn default() -> Self {
Self {
domain_name: "stranger.systems".to_string(),
https: true,
}
}
}
/// Top level configuration for a site
///
/// Describes the file located at `site/config.dhall`
#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
/// Doman name settings
pub domain: Domain,
}