From ddb46f9dda6d48a7aea3c4cb8b8952da619aa672 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Wed, 28 May 2025 10:17:33 +0800 Subject: [PATCH] refactor: clean code --- internal/domain/workflow.go | 8 ++++---- .../providers/aliyun-cas-deploy/aliyun_cas_deploy.go | 2 +- .../deployer/providers/baotawaf-site/baotawaf_site.go | 2 +- internal/pkg/core/deployer/providers/local/local.go | 2 +- internal/pkg/core/deployer/providers/ssh/ssh.go | 8 ++++---- internal/pkg/core/deployer/providers/webhook/webhook.go | 2 +- internal/pkg/core/notifier/providers/bark/bark.go | 2 +- internal/pkg/core/notifier/providers/webhook/webhook.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/domain/workflow.go b/internal/domain/workflow.go index 6a96dd81..10925b72 100644 --- a/internal/domain/workflow.go +++ b/internal/domain/workflow.go @@ -68,17 +68,17 @@ type WorkflowNodeConfigForApply struct { Provider string `json:"provider"` // DNS 提供商 ProviderAccessId string `json:"providerAccessId"` // DNS 提供商授权记录 ID ProviderConfig map[string]any `json:"providerConfig"` // DNS 提供商额外配置 - CAProvider string `json:"caProvider,omitempty"` // CA 提供商(零值将使用全局配置) + CAProvider string `json:"caProvider,omitempty"` // CA 提供商(零值时使用全局配置) CAProviderAccessId string `json:"caProviderAccessId,omitempty"` // CA 提供商授权记录 ID CAProviderConfig map[string]any `json:"caProviderConfig,omitempty"` // CA 提供商额外配置 KeyAlgorithm string `json:"keyAlgorithm"` // 证书算法 Nameservers string `json:"nameservers,omitempty"` // DNS 服务器列表,以半角分号分隔 DnsPropagationWait int32 `json:"dnsPropagationWait,omitempty"` // DNS 传播等待时间,等同于 lego 的 `--dns-propagation-wait` 参数 - DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"` // DNS 传播检查超时时间(零值取决于提供商的默认值) - DnsTTL int32 `json:"dnsTTL,omitempty"` // DNS 解析记录 TTL(零值取决于提供商的默认值) + DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"` // DNS 传播检查超时时间(零值时使用提供商的默认值) + DnsTTL int32 `json:"dnsTTL,omitempty"` // DNS 解析记录 TTL(零值时使用提供商的默认值) DisableFollowCNAME bool `json:"disableFollowCNAME,omitempty"` // 是否关闭 CNAME 跟随 DisableARI bool `json:"disableARI,omitempty"` // 是否关闭 ARI - SkipBeforeExpiryDays int32 `json:"skipBeforeExpiryDays,omitempty"` // 证书到期前多少天前跳过续期(零值将使用默认值 30) + SkipBeforeExpiryDays int32 `json:"skipBeforeExpiryDays,omitempty"` // 证书到期前多少天前跳过续期(零值时默认值 30) } type WorkflowNodeConfigForUpload struct { diff --git a/internal/pkg/core/deployer/providers/aliyun-cas-deploy/aliyun_cas_deploy.go b/internal/pkg/core/deployer/providers/aliyun-cas-deploy/aliyun_cas_deploy.go index 569edaf3..5acdb50e 100644 --- a/internal/pkg/core/deployer/providers/aliyun-cas-deploy/aliyun_cas_deploy.go +++ b/internal/pkg/core/deployer/providers/aliyun-cas-deploy/aliyun_cas_deploy.go @@ -29,7 +29,7 @@ type DeployerConfig struct { // 阿里云云产品资源 ID 数组。 ResourceIds []string `json:"resourceIds"` // 阿里云云联系人 ID 数组。 - // 零值时默认使用账号下第一个联系人。 + // 零值时使用账号下第一个联系人。 ContactIds []string `json:"contactIds"` } diff --git a/internal/pkg/core/deployer/providers/baotawaf-site/baotawaf_site.go b/internal/pkg/core/deployer/providers/baotawaf-site/baotawaf_site.go index 435f7a69..945d5a48 100644 --- a/internal/pkg/core/deployer/providers/baotawaf-site/baotawaf_site.go +++ b/internal/pkg/core/deployer/providers/baotawaf-site/baotawaf_site.go @@ -23,7 +23,7 @@ type DeployerConfig struct { // 网站名称。 SiteName string `json:"siteName"` // 网站 SSL 端口。 - // 零值时默认为 443。 + // 零值时默认值 443。 SitePort int32 `json:"sitePort,omitempty"` } diff --git a/internal/pkg/core/deployer/providers/local/local.go b/internal/pkg/core/deployer/providers/local/local.go index a71ad9d3..8b05d95b 100644 --- a/internal/pkg/core/deployer/providers/local/local.go +++ b/internal/pkg/core/deployer/providers/local/local.go @@ -15,7 +15,7 @@ import ( type DeployerConfig struct { // Shell 执行环境。 - // 零值时默认根据操作系统决定。 + // 零值时根据操作系统决定。 ShellEnv ShellEnvType `json:"shellEnv,omitempty"` // 前置命令。 PreCommand string `json:"preCommand,omitempty"` diff --git a/internal/pkg/core/deployer/providers/ssh/ssh.go b/internal/pkg/core/deployer/providers/ssh/ssh.go index ae6e459f..96447cfb 100644 --- a/internal/pkg/core/deployer/providers/ssh/ssh.go +++ b/internal/pkg/core/deployer/providers/ssh/ssh.go @@ -19,10 +19,10 @@ import ( type JumpServerConfig struct { // SSH 主机。 - // 零值时默认为 "localhost"。 + // 零值时默认值 "localhost"。 SshHost string `json:"sshHost,omitempty"` // SSH 端口。 - // 零值时默认为 22。 + // 零值时默认值 22。 SshPort int32 `json:"sshPort,omitempty"` // SSH 登录用户名。 SshUsername string `json:"sshUsername,omitempty"` @@ -36,10 +36,10 @@ type JumpServerConfig struct { type DeployerConfig struct { // SSH 主机。 - // 零值时默认为 "localhost"。 + // 零值时默认值 "localhost"。 SshHost string `json:"sshHost,omitempty"` // SSH 端口。 - // 零值时默认为 22。 + // 零值时默认值 22。 SshPort int32 `json:"sshPort,omitempty"` // SSH 登录用户名。 SshUsername string `json:"sshUsername,omitempty"` diff --git a/internal/pkg/core/deployer/providers/webhook/webhook.go b/internal/pkg/core/deployer/providers/webhook/webhook.go index 49b07b47..b25c129a 100644 --- a/internal/pkg/core/deployer/providers/webhook/webhook.go +++ b/internal/pkg/core/deployer/providers/webhook/webhook.go @@ -23,7 +23,7 @@ type DeployerConfig struct { // Webhook 回调数据(application/json 或 application/x-www-form-urlencoded 格式)。 WebhookData string `json:"webhookData,omitempty"` // 请求谓词。 - // 零值时默认为 "POST"。 + // 零值时默认值 "POST"。 Method string `json:"method,omitempty"` // 请求标头。 Headers map[string]string `json:"headers,omitempty"` diff --git a/internal/pkg/core/notifier/providers/bark/bark.go b/internal/pkg/core/notifier/providers/bark/bark.go index ec0d44f3..fb3298ec 100644 --- a/internal/pkg/core/notifier/providers/bark/bark.go +++ b/internal/pkg/core/notifier/providers/bark/bark.go @@ -12,7 +12,7 @@ import ( type NotifierConfig struct { // Bark 服务地址。 - // 零值时默认使用官方服务器。 + // 零值时使用官方服务器。 ServerUrl string `json:"serverUrl"` // Bark 设备密钥。 DeviceKey string `json:"deviceKey"` diff --git a/internal/pkg/core/notifier/providers/webhook/webhook.go b/internal/pkg/core/notifier/providers/webhook/webhook.go index 8850ea73..acc0caab 100644 --- a/internal/pkg/core/notifier/providers/webhook/webhook.go +++ b/internal/pkg/core/notifier/providers/webhook/webhook.go @@ -22,7 +22,7 @@ type NotifierConfig struct { // Webhook 回调数据(application/json 或 application/x-www-form-urlencoded 格式)。 WebhookData string `json:"webhookData,omitempty"` // 请求谓词。 - // 零值时默认为 "POST"。 + // 零值时默认值 "POST"。 Method string `json:"method,omitempty"` // 请求标头。 Headers map[string]string `json:"headers,omitempty"`