refactor: rename forge as forge_config
Some checks failed
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline failed
ci/woodpecker/push/push-next Pipeline failed

This commit is contained in:
Paul Campbell 2024-04-23 07:13:16 +01:00
parent 17f5f62e61
commit 3dfbd44b37
2 changed files with 13 additions and 14 deletions

View file

@ -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(),
},
}
}

View file

@ -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(),