git-next/src/server/actors/repo/config.rs
Paul Campbell 3bbe9abbd9 test: Create stub mock forge
Still need to figure out what tests this will need to support, and how
to configure it's behaviour. I've not ruled out creating a forge object
that is passed in rather than the functions we have now.

Closes kemitix/git-next#37
2024-04-12 22:43:19 +01:00

25 lines
709 B
Rust

use actix::prelude::*;
use kxio::network::Network;
use tracing::error;
use crate::server::{
config::{ForgeType, RepoDetails},
forge,
};
use super::{LoadedConfig, RepoActor};
pub async fn load(details: RepoDetails, addr: Addr<RepoActor>, net: Network) {
let config = match details.forge.forge_type {
#[cfg(feature = "forgejo")]
ForgeType::ForgeJo => forge::forgejo::config::load(&details, &net).await,
#[cfg(test)]
ForgeType::MockForge => forge::mock::config::load(&details, &net).await,
};
match config {
Ok(config) => addr.do_send(LoadedConfig(config)),
Err(err) => {
error!(?err, "Failed to load config");
}
}
}