forked from kemitix/git-next
refactor: move server config loading out of forgejo module
Delete empty modules left over
This commit is contained in:
parent
0bfa1df875
commit
50a969ede6
9 changed files with 9 additions and 55 deletions
|
@ -1,31 +1,17 @@
|
|||
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<RepoActor>, 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 {
|
||||
pub async fn load(repo_details: RepoDetails, addr: Addr<RepoActor>, 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));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
pub mod load;
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::{Display, Formatter},
|
|
@ -1 +0,0 @@
|
|||
pub mod config;
|
|
@ -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<RepoConfig, OneOf<(ForgeFileError, toml::de::Error, RepoConfigValidationErrors)>> {
|
||||
todo!()
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
pub mod config;
|
|
@ -1,7 +0,0 @@
|
|||
#[cfg(feature = "forgejo")]
|
||||
pub mod forgejo;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod mock;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
|
@ -1,10 +0,0 @@
|
|||
use kxio::network;
|
||||
|
||||
use crate::server::gitforge;
|
||||
|
||||
#[test]
|
||||
const fn test_is_send() {
|
||||
const fn assert_send<T: Send>() {}
|
||||
assert_send::<gitforge::CommitHistories>();
|
||||
assert_send::<network::NetworkError>();
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
mod actors;
|
||||
mod config;
|
||||
pub mod forge;
|
||||
pub mod gitforge;
|
||||
pub mod types;
|
||||
|
||||
|
|
Loading…
Reference in a new issue