refactor(repo_actor): consitent use of config crate
All checks were successful
Rust / build (push) Successful in 1m17s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-23 17:56:47 +01:00
parent 17b1629cdf
commit 9e37c073c2
2 changed files with 8 additions and 7 deletions

View file

@ -2,7 +2,7 @@ use std::time::Duration;
use actix::prelude::*;
use git_next_config::RepoConfig;
use git_next_config as config;
use git_next_forge as forge;
use git_next_git as git;
use tracing::{info, warn};
@ -14,7 +14,7 @@ use crate::{MessageToken, ValidateRepo};
pub async fn advance_next(
next: git::Commit,
dev_commit_history: Vec<git::Commit>,
repo_config: RepoConfig,
repo_config: config::RepoConfig,
forge: forge::Forge,
repository: git::OpenRepository,
addr: Addr<super::RepoActor>,
@ -78,7 +78,7 @@ pub fn find_next_commit_on_dev(
#[tracing::instrument(fields(next), skip_all)]
pub async fn advance_main(
next: git::Commit,
repo_config: &RepoConfig,
repo_config: &config::RepoConfig,
forge: &forge::Forge,
repository: &git::OpenRepository,
) {

View file

@ -11,6 +11,7 @@ use std::time::Duration;
use actix::prelude::*;
use crate as repo_actor;
use git_next_config as config;
use git_next_forge as forge;
use git_next_git as git;
@ -23,7 +24,7 @@ pub struct RepoActor {
generation: git::Generation,
message_token: MessageToken,
details: git::RepoDetails,
webhook: git_next_config::server::Webhook,
webhook: config::server::Webhook,
webhook_id: Option<webhook::WebhookId>, // INFO: if [None] then no webhook is configured
webhook_auth: Option<webhook::WebhookAuth>, // INFO: if [None] then no webhook is configured
last_main_commit: Option<git::Commit>,
@ -36,17 +37,17 @@ pub struct RepoActor {
impl RepoActor {
pub fn new(
details: git::RepoDetails,
webhook: git_next_config::server::Webhook,
webhook: config::server::Webhook,
generation: git::Generation,
net: Network,
repo: git::Repository,
) -> Self {
let forge = match details.forge.forge_type() {
#[cfg(feature = "forgejo")]
git_next_config::ForgeType::ForgeJo => {
config::ForgeType::ForgeJo => {
forge::Forge::new_forgejo(details.clone(), net.clone(), repo)
}
git_next_config::ForgeType::MockForge => forge::Forge::new_mock(),
config::ForgeType::MockForge => forge::Forge::new_mock(),
};
debug!(?forge, "new");
Self {