From 68ccc9534541437384335c9c4741f5dad18f24ce Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Wed, 15 Mar 2023 20:14:39 -0400 Subject: [PATCH] feat: Create config module --- src/site.rs | 10 +++++++++- src/site/config.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/site/config.rs diff --git a/src/site.rs b/src/site.rs index 30eab94..2f603f5 100644 --- a/src/site.rs +++ b/src/site.rs @@ -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, +} diff --git a/src/site/config.rs b/src/site/config.rs new file mode 100644 index 0000000..f037bbe --- /dev/null +++ b/src/site/config.rs @@ -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, +}