From 16dc823f58aded0bcabaea46efd223f6e0ee6904 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 19 Apr 2024 18:49:03 +0100 Subject: [PATCH] feat(config): User must specify a directory to store data Closes kemitix/git-next#55 --- src/server/config/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/server/config/mod.rs b/src/server/config/mod.rs index 548d829..39c269b 100644 --- a/src/server/config/mod.rs +++ b/src/server/config/mod.rs @@ -17,6 +17,7 @@ use crate::filesystem::FileSystem; #[derive(Debug, PartialEq, Eq, Deserialize)] pub struct ServerConfig { webhook: Webhook, + storage: ServerStorage, forge: HashMap, } impl ServerConfig { @@ -56,6 +57,12 @@ impl AsRef for WebhookUrl { } } +/// The directory to store server data, such as cloned repos +#[derive(Clone, Debug, PartialEq, Eq, Deserialize)] +pub struct ServerStorage { + path: PathBuf, +} + /// Mapped from `.git-next.toml` file in target repo /// Is also derived from the optional parameters in `git-next-server.toml` at /// `forge.{forge}.repos.{repo}.(main|next|dev)` @@ -394,6 +401,9 @@ mod tests { [webhook] url = "http://localhost:9909/webhook" + [storage] + path = "/opt/git-next/data" + [forge.default] forge_type = "MockForge" hostname = "git.example.net" @@ -418,6 +428,9 @@ mod tests { webhook: Webhook { url: "http://localhost:9909/webhook".to_string(), }, + storage: ServerStorage { + path: "/opt/git-next/data".into(), + }, forge: HashMap::from([( "default".to_string(), ForgeConfig {