[PR #937] [MERGED] refactor #1081

Closed
opened 2026-03-03 01:07:36 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/certimate-go/certimate/pull/937
Author: @fudiwei
Created: 8/29/2025
Status: Merged
Merged: 8/29/2025
Merged by: @fudiwei

Base: nextHead: dev


📝 Commits (8)

  • f82d43e feat: try to query bind result before deploy to tencentcloud cos
  • be54892 fix(ui): missing field "workflowRef" of CertificateModel
  • 5f6981e chore(ui): improve i18n
  • 219d907 refactor: optimize f82d43e1
  • 85088c7 refactor: acme providers factory
  • 35de861 refactor: notification providers factory
  • 40a740a refactor: deployment providers factory
  • 4219093 chore: modify directory structure

📊 Changes

165 files changed (+4819 additions, -2370 deletions)

View changed files

📝 internal/applicant/providers.go (+11 -668)
internal/certapply/applicators/registry.go (+69 -0)
internal/certapply/applicators/sp_acmehttpreq.go (+31 -0)
internal/certapply/applicators/sp_aliyun_dns.go (+34 -0)
internal/certapply/applicators/sp_aliyun_esa.go (+31 -0)
internal/certapply/applicators/sp_aws_route53.go (+36 -0)
internal/certapply/applicators/sp_azure_dns.go (+36 -0)
internal/certapply/applicators/sp_baiducloud_dns.go (+34 -0)
internal/certapply/applicators/sp_bunny.go (+29 -0)
internal/certapply/applicators/sp_cloudflare.go (+30 -0)
internal/certapply/applicators/sp_cloudns.go (+30 -0)
internal/certapply/applicators/sp_cmcccloud_dns.go (+34 -0)
internal/certapply/applicators/sp_constellix.go (+30 -0)
internal/certapply/applicators/sp_ctcccloud_smartdns.go (+34 -0)
internal/certapply/applicators/sp_desec.go (+29 -0)
internal/certapply/applicators/sp_digitalocean.go (+29 -0)
internal/certapply/applicators/sp_dnsla.go (+30 -0)
internal/certapply/applicators/sp_duckdns.go (+28 -0)
internal/certapply/applicators/sp_dynv6.go (+29 -0)
internal/certapply/applicators/sp_gcore.go (+29 -0)

...and 80 more files

📄 Description

该 PR 包含以下内容变更:

  • refactor: 重构提供商工厂(见备注)。

备注

关于提供商工厂

原构造提供商的相关逻辑代码位于 /internal/applicant/providers.go/internal/deployer/providers.go/internal/notify/providers.go 三个文件中。存在以下三个缺点:

  1. 代码膨胀。所有提供商相关逻辑都在一起,代码行数急遽膨胀。
  2. 文件冲突。多人协作时如需添加多个提供商,会修改同一文件,易产生冲突。
  3. 拼写错误。提供商名称与工厂的映射关系易存在遗漏或重复的问题。

新的构造提供商抽象出 Registry(注册表)这一结构,利用 go 语言本身的模块 init() 特性,将各提供商工厂拆分成独立的文件,消除了上述三个缺点。


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/certimate-go/certimate/pull/937 **Author:** [@fudiwei](https://github.com/fudiwei) **Created:** 8/29/2025 **Status:** ✅ Merged **Merged:** 8/29/2025 **Merged by:** [@fudiwei](https://github.com/fudiwei) **Base:** `next` ← **Head:** `dev` --- ### 📝 Commits (8) - [`f82d43e`](https://github.com/certimate-go/certimate/commit/f82d43e10e90c448cb4bc19f5142c835d456bf07) feat: try to query bind result before deploy to tencentcloud cos - [`be54892`](https://github.com/certimate-go/certimate/commit/be548929e55b61a2e0124cd9646e8aa072b0eada) fix(ui): missing field "workflowRef" of CertificateModel - [`5f6981e`](https://github.com/certimate-go/certimate/commit/5f6981ea272bbd9fbe9186d26fa3a64b6a53b3e4) chore(ui): improve i18n - [`219d907`](https://github.com/certimate-go/certimate/commit/219d907f790555b964f28256374f9d4053bd9ea0) refactor: optimize f82d43e1 - [`85088c7`](https://github.com/certimate-go/certimate/commit/85088c74b0165dab5ab0071c87583af16b525e51) refactor: acme providers factory - [`35de861`](https://github.com/certimate-go/certimate/commit/35de8619f2789d4bb428f715e9097b96824f63ee) refactor: notification providers factory - [`40a740a`](https://github.com/certimate-go/certimate/commit/40a740a604f0052704e3139762f8457071be7195) refactor: deployment providers factory - [`4219093`](https://github.com/certimate-go/certimate/commit/42190937bf540e5f6160cf7c4512f83973bbfa45) chore: modify directory structure ### 📊 Changes **165 files changed** (+4819 additions, -2370 deletions) <details> <summary>View changed files</summary> 📝 `internal/applicant/providers.go` (+11 -668) ➕ `internal/certapply/applicators/registry.go` (+69 -0) ➕ `internal/certapply/applicators/sp_acmehttpreq.go` (+31 -0) ➕ `internal/certapply/applicators/sp_aliyun_dns.go` (+34 -0) ➕ `internal/certapply/applicators/sp_aliyun_esa.go` (+31 -0) ➕ `internal/certapply/applicators/sp_aws_route53.go` (+36 -0) ➕ `internal/certapply/applicators/sp_azure_dns.go` (+36 -0) ➕ `internal/certapply/applicators/sp_baiducloud_dns.go` (+34 -0) ➕ `internal/certapply/applicators/sp_bunny.go` (+29 -0) ➕ `internal/certapply/applicators/sp_cloudflare.go` (+30 -0) ➕ `internal/certapply/applicators/sp_cloudns.go` (+30 -0) ➕ `internal/certapply/applicators/sp_cmcccloud_dns.go` (+34 -0) ➕ `internal/certapply/applicators/sp_constellix.go` (+30 -0) ➕ `internal/certapply/applicators/sp_ctcccloud_smartdns.go` (+34 -0) ➕ `internal/certapply/applicators/sp_desec.go` (+29 -0) ➕ `internal/certapply/applicators/sp_digitalocean.go` (+29 -0) ➕ `internal/certapply/applicators/sp_dnsla.go` (+30 -0) ➕ `internal/certapply/applicators/sp_duckdns.go` (+28 -0) ➕ `internal/certapply/applicators/sp_dynv6.go` (+29 -0) ➕ `internal/certapply/applicators/sp_gcore.go` (+29 -0) _...and 80 more files_ </details> ### 📄 Description 该 PR 包含以下内容变更: - **refactor**: 重构提供商工厂(见备注)。 --- ### 备注 #### 关于提供商工厂 原构造提供商的相关逻辑代码位于 `/internal/applicant/providers.go`、`/internal/deployer/providers.go`、`/internal/notify/providers.go` 三个文件中。存在以下三个缺点: 1. 代码膨胀。所有提供商相关逻辑都在一起,代码行数急遽膨胀。 2. 文件冲突。多人协作时如需添加多个提供商,会修改同一文件,易产生冲突。 3. 拼写错误。提供商名称与工厂的映射关系易存在遗漏或重复的问题。 新的构造提供商抽象出 `Registry`(注册表)这一结构,利用 go 语言本身的模块 `init()` 特性,将各提供商工厂拆分成独立的文件,消除了上述三个缺点。 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 01:07:36 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/certimate#1081
No description provided.