forked from kemitix/git-next
refactor(repo_actor): consitent use of config crate
This commit is contained in:
parent
17b1629cdf
commit
9e37c073c2
2 changed files with 8 additions and 7 deletions
|
@ -2,7 +2,7 @@ use std::time::Duration;
|
||||||
|
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use git_next_config::RepoConfig;
|
use git_next_config as config;
|
||||||
use git_next_forge as forge;
|
use git_next_forge as forge;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
@ -14,7 +14,7 @@ use crate::{MessageToken, ValidateRepo};
|
||||||
pub async fn advance_next(
|
pub async fn advance_next(
|
||||||
next: git::Commit,
|
next: git::Commit,
|
||||||
dev_commit_history: Vec<git::Commit>,
|
dev_commit_history: Vec<git::Commit>,
|
||||||
repo_config: RepoConfig,
|
repo_config: config::RepoConfig,
|
||||||
forge: forge::Forge,
|
forge: forge::Forge,
|
||||||
repository: git::OpenRepository,
|
repository: git::OpenRepository,
|
||||||
addr: Addr<super::RepoActor>,
|
addr: Addr<super::RepoActor>,
|
||||||
|
@ -78,7 +78,7 @@ pub fn find_next_commit_on_dev(
|
||||||
#[tracing::instrument(fields(next), skip_all)]
|
#[tracing::instrument(fields(next), skip_all)]
|
||||||
pub async fn advance_main(
|
pub async fn advance_main(
|
||||||
next: git::Commit,
|
next: git::Commit,
|
||||||
repo_config: &RepoConfig,
|
repo_config: &config::RepoConfig,
|
||||||
forge: &forge::Forge,
|
forge: &forge::Forge,
|
||||||
repository: &git::OpenRepository,
|
repository: &git::OpenRepository,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ use std::time::Duration;
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use crate as repo_actor;
|
use crate as repo_actor;
|
||||||
|
use git_next_config as config;
|
||||||
use git_next_forge as forge;
|
use git_next_forge as forge;
|
||||||
use git_next_git as git;
|
use git_next_git as git;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ pub struct RepoActor {
|
||||||
generation: git::Generation,
|
generation: git::Generation,
|
||||||
message_token: MessageToken,
|
message_token: MessageToken,
|
||||||
details: git::RepoDetails,
|
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_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
|
webhook_auth: Option<webhook::WebhookAuth>, // INFO: if [None] then no webhook is configured
|
||||||
last_main_commit: Option<git::Commit>,
|
last_main_commit: Option<git::Commit>,
|
||||||
|
@ -36,17 +37,17 @@ pub struct RepoActor {
|
||||||
impl RepoActor {
|
impl RepoActor {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
details: git::RepoDetails,
|
details: git::RepoDetails,
|
||||||
webhook: git_next_config::server::Webhook,
|
webhook: config::server::Webhook,
|
||||||
generation: git::Generation,
|
generation: git::Generation,
|
||||||
net: Network,
|
net: Network,
|
||||||
repo: git::Repository,
|
repo: git::Repository,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let forge = match details.forge.forge_type() {
|
let forge = match details.forge.forge_type() {
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
git_next_config::ForgeType::ForgeJo => {
|
config::ForgeType::ForgeJo => {
|
||||||
forge::Forge::new_forgejo(details.clone(), net.clone(), repo)
|
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");
|
debug!(?forge, "new");
|
||||||
Self {
|
Self {
|
||||||
|
|
Loading…
Reference in a new issue