From 3dfbd44b373bbd0bcfc5e3a0d732945319e6cb83 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 23 Apr 2024 07:13:16 +0100 Subject: [PATCH] refactor: rename forge as forge_config --- src/server/config/mod.rs | 10 +++++----- src/server/mod.rs | 17 ++++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/server/config/mod.rs b/src/server/config/mod.rs index 791f46b2..d195858a 100644 --- a/src/server/config/mod.rs +++ b/src/server/config/mod.rs @@ -335,7 +335,7 @@ impl RepoDetails { name: &RepoAlias, server_repo_config: &ServerRepoConfig, forge_name: &ForgeName, - forge: &ForgeConfig, + forge_config: &ForgeConfig, server_storage: &ServerStorage, ) -> Self { Self { @@ -351,10 +351,10 @@ impl RepoDetails { ), forge: ForgeDetails { forge_name: forge_name.clone(), - forge_type: forge.forge_type.clone(), - hostname: forge.hostname(), - user: forge.user(), - token: forge.token(), + forge_type: forge_config.forge_type.clone(), + hostname: forge_config.hostname(), + user: forge_config.user(), + token: forge_config.token(), }, } } diff --git a/src/server/mod.rs b/src/server/mod.rs index 5c40dfc5..fd50498c 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -59,8 +59,8 @@ pub async fn start(fs: FileSystem, net: Network) { server_config .forges() - .flat_map(|(forge_name, forge)| { - create_forge_repos(forge, forge_name, server_storage, webhook, &net) + .flat_map(|(forge_name, forge_config)| { + create_forge_repos(forge_config, forge_name, server_storage, webhook, &net) }) .map(start_actor) .map(|(alias, addr)| webhook::AddWebhookRecipient(alias, addr.recipient())) @@ -72,21 +72,20 @@ pub async fn start(fs: FileSystem, net: Network) { } fn create_forge_repos( - forge: &ForgeConfig, + forge_config: &ForgeConfig, forge_name: ForgeName, server_storage: &ServerStorage, webhook: &Webhook, net: &Network, ) -> Vec<(ForgeName, RepoAlias, RepoActor)> { - let forge = forge.clone(); - let span = tracing::info_span!("Forge", %forge_name, %forge); + let span = tracing::info_span!("Forge", %forge_name, %forge_config); let _guard = span.enter(); info!("Creating Forge"); - forge + forge_config .repos() .map(create_actor( forge_name, - forge.clone(), + forge_config.clone(), server_storage, webhook, net, @@ -96,7 +95,7 @@ fn create_forge_repos( fn create_actor( forge_name: ForgeName, - forge: config::ForgeConfig, + forge_config: config::ForgeConfig, server_storage: &ServerStorage, webhook: &Webhook, net: &Network, @@ -113,7 +112,7 @@ fn create_actor( &repo_name, server_repo_config, &forge_name, - &forge, + &forge_config, &server_storage, ), webhook.clone(),