2024-04-09 10:44:01 +01:00
|
|
|
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 {
|
2024-04-09 14:52:12 +01:00
|
|
|
ForgeType::ForgeJo => forge::forgejo::config::load(&details, &net).await,
|
2024-04-09 10:44:01 +01:00
|
|
|
};
|
|
|
|
match config {
|
|
|
|
Ok(config) => addr.do_send(LoadedConfig(config)),
|
|
|
|
Err(err) => {
|
|
|
|
error!(?err, "Failed to load config");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|