diff --git a/src/server/actors/repo/config.rs b/src/server/actors/repo/config.rs index 32ef412b..f1eb98e1 100644 --- a/src/server/actors/repo/config.rs +++ b/src/server/actors/repo/config.rs @@ -1,30 +1,16 @@ use actix::prelude::*; use tracing::error; -use crate::server::{ - config::{ForgeType, RepoDetails}, - forge, gitforge, -}; +use crate::server::{config::RepoDetails, gitforge}; use super::{LoadedConfig, RepoActor}; -pub async fn load(details: RepoDetails, addr: Addr, forge: gitforge::Forge) { - let config = match details.config { - Some(config) => config, - None => { - let config = match details.forge.forge_type { - #[cfg(feature = "forgejo")] - ForgeType::ForgeJo => forge::forgejo::config::load(&details, &forge).await, - #[cfg(test)] - ForgeType::MockForge => forge::mock::config::load(&details, &forge).await, - }; - match config { - Ok(config) => config, - Err(err) => { - error!(?err, "Failed to load config"); - return; - } - } +pub async fn load(repo_details: RepoDetails, addr: Addr, forge: gitforge::Forge) { + let config = match crate::server::config::load::load(&repo_details, &forge).await { + Ok(config) => config, + Err(err) => { + error!(?err, "Failed to load config"); + return; } }; addr.do_send(LoadedConfig(config)); diff --git a/src/server/forge/forgejo/config.rs b/src/server/config/load.rs similarity index 100% rename from src/server/forge/forgejo/config.rs rename to src/server/config/load.rs diff --git a/src/server/config.rs b/src/server/config/mod.rs similarity index 99% rename from src/server/config.rs rename to src/server/config/mod.rs index 0afd9eb4..87402fa3 100644 --- a/src/server/config.rs +++ b/src/server/config/mod.rs @@ -1,3 +1,5 @@ +pub mod load; + use std::{ collections::HashMap, fmt::{Display, Formatter}, diff --git a/src/server/forge/forgejo/mod.rs b/src/server/forge/forgejo/mod.rs deleted file mode 100644 index ef68c369..00000000 --- a/src/server/forge/forgejo/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod config; diff --git a/src/server/forge/mock/config.rs b/src/server/forge/mock/config.rs deleted file mode 100644 index 6202bd20..00000000 --- a/src/server/forge/mock/config.rs +++ /dev/null @@ -1,14 +0,0 @@ -use terrors::OneOf; - -use crate::server::{ - config::RepoConfig, - forge::forgejo::config::RepoConfigValidationErrors, - gitforge::{self, ForgeFileError}, -}; - -pub async fn load( - _details: &crate::server::config::RepoDetails, - _forge: &gitforge::Forge, -) -> Result> { - todo!() -} diff --git a/src/server/forge/mock/mod.rs b/src/server/forge/mock/mod.rs deleted file mode 100644 index ef68c369..00000000 --- a/src/server/forge/mock/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod config; diff --git a/src/server/forge/mod.rs b/src/server/forge/mod.rs deleted file mode 100644 index 44fa00ab..00000000 --- a/src/server/forge/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[cfg(feature = "forgejo")] -pub mod forgejo; - -#[cfg(test)] -pub mod mock; -#[cfg(test)] -mod tests; diff --git a/src/server/forge/tests.rs b/src/server/forge/tests.rs deleted file mode 100644 index 9b3cf6ce..00000000 --- a/src/server/forge/tests.rs +++ /dev/null @@ -1,10 +0,0 @@ -use kxio::network; - -use crate::server::gitforge; - -#[test] -const fn test_is_send() { - const fn assert_send() {} - assert_send::(); - assert_send::(); -} diff --git a/src/server/mod.rs b/src/server/mod.rs index ea604555..242a0eb3 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1,6 +1,5 @@ mod actors; mod config; -pub mod forge; pub mod gitforge; pub mod types;