mirror of
https://github.com/certimate-go/certimate.git
synced 2026-08-30 18:01:43 +08:00
fix: #1292
This commit is contained in:
@@ -23,7 +23,7 @@ func init() {
|
||||
SecretId: credentials.SecretId,
|
||||
SecretKey: credentials.SecretKey,
|
||||
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
|
||||
Region: xmaps.GetString(options.ProviderExtendedConfig, "region"),
|
||||
ResourceRegion: xmaps.GetString(options.ProviderExtendedConfig, "resourceRegion"),
|
||||
ResourceProduct: xmaps.GetString(options.ProviderExtendedConfig, "resourceProduct"),
|
||||
ResourceIds: lo.Filter(strings.Split(xmaps.GetString(options.ProviderExtendedConfig, "resourceIds"), ";"), func(s string, _ int) bool { return s != "" }),
|
||||
})
|
||||
|
||||
@@ -24,9 +24,9 @@ func init() {
|
||||
SecretKey: credentials.SecretKey,
|
||||
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
|
||||
CertificateId: xmaps.GetString(options.ProviderExtendedConfig, "certificateId"),
|
||||
IsReplaced: xmaps.GetBool(options.ProviderExtendedConfig, "isReplaced"),
|
||||
ResourceProducts: lo.Filter(strings.Split(xmaps.GetString(options.ProviderExtendedConfig, "resourceProducts"), ";"), func(s string, _ int) bool { return s != "" }),
|
||||
ResourceRegions: lo.Filter(strings.Split(xmaps.GetString(options.ProviderExtendedConfig, "resourceRegions"), ";"), func(s string, _ int) bool { return s != "" }),
|
||||
ResourceProducts: lo.Filter(strings.Split(xmaps.GetString(options.ProviderExtendedConfig, "resourceProducts"), ";"), func(s string, _ int) bool { return s != "" }),
|
||||
IsReplaced: xmaps.GetBool(options.ProviderExtendedConfig, "isReplaced"),
|
||||
})
|
||||
return provider, err
|
||||
})
|
||||
|
||||
@@ -26,19 +26,6 @@ func init() {
|
||||
nodeCfg := node.Data.Config
|
||||
|
||||
switch nodeCfg["provider"] {
|
||||
case "1panel", "aliyun-alb", "aliyun-clb", "aliyun-ga", "aliyun-nlb", "apisix", "baiducloud-appblb", "baiducloud-blb", "baishan-cdn", "cdnfly", "cpanel", "ctcccloud-elb", "flexcdn", "goedge", "huaweicloud-apig", "huaweicloud-elb", "huaweicloud-waf", "jdcloud-alb", "kong", "ksyun-cdn", "ksyun-slb", "lecdn", "netlify", "nginxproxymanager", "ratpanel", "safeline", "samwaf", "tencentcloud-clb", "tencentcloud-gaap", "ucloud-uclb", "volcengine-alb", "volcengine-clb", "zenlayer-cdn", "zenlayer-ga":
|
||||
{
|
||||
if providerCfg, ok := nodeCfg["providerConfig"].(map[string]any); ok {
|
||||
if providerCfg["resourceType"] != nil && providerCfg["resourceType"].(string) != "" {
|
||||
providerCfg["deployTarget"] = providerCfg["resourceType"]
|
||||
delete(providerCfg, "resourceType")
|
||||
nodeCfg["providerConfig"] = providerCfg
|
||||
|
||||
_changed = true
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
case "ftp", "local", "ssh":
|
||||
{
|
||||
if providerCfg, ok := nodeCfg["providerConfig"].(map[string]any); ok {
|
||||
@@ -60,6 +47,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case "s3":
|
||||
{
|
||||
if providerCfg, ok := nodeCfg["providerConfig"].(map[string]any); ok {
|
||||
@@ -76,6 +64,34 @@ func init() {
|
||||
delete(providerCfg, "certObjectKeyForIntermediaOnly")
|
||||
nodeCfg["providerConfig"] = providerCfg
|
||||
|
||||
_changed = true
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case "1panel", "aliyun-alb", "aliyun-clb", "aliyun-ga", "aliyun-nlb", "apisix", "baiducloud-appblb", "baiducloud-blb", "baishan-cdn", "cdnfly", "cpanel", "ctcccloud-elb", "flexcdn", "goedge", "huaweicloud-apig", "huaweicloud-elb", "huaweicloud-waf", "jdcloud-alb", "kong", "ksyun-cdn", "ksyun-slb", "lecdn", "netlify", "nginxproxymanager", "ratpanel", "safeline", "samwaf", "tencentcloud-clb", "tencentcloud-gaap", "ucloud-uclb", "volcengine-alb", "volcengine-clb", "zenlayer-cdn", "zenlayer-ga":
|
||||
{
|
||||
if providerCfg, ok := nodeCfg["providerConfig"].(map[string]any); ok {
|
||||
if providerCfg["resourceType"] != nil && providerCfg["resourceType"].(string) != "" {
|
||||
providerCfg["deployTarget"] = providerCfg["resourceType"]
|
||||
delete(providerCfg, "resourceType")
|
||||
nodeCfg["providerConfig"] = providerCfg
|
||||
|
||||
_changed = true
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case "tencentcloud-ssldeploy":
|
||||
{
|
||||
if providerCfg, ok := nodeCfg["providerConfig"].(map[string]any); ok {
|
||||
if providerCfg["region"] != nil && providerCfg["region"].(string) != "" {
|
||||
providerCfg["resourceRegion"] = providerCfg["region"]
|
||||
delete(providerCfg, "region")
|
||||
nodeCfg["providerConfig"] = providerCfg
|
||||
|
||||
_changed = true
|
||||
return
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ type DeployerConfig struct {
|
||||
SecretKey string `json:"secretKey"`
|
||||
// 腾讯云接口端点。
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
// 腾讯云地域。
|
||||
Region string `json:"region"`
|
||||
// 云产品地域。
|
||||
ResourceRegion string `json:"resourceRegion,omitempty"`
|
||||
// 云产品类型。
|
||||
ResourceProduct string `json:"resourceProduct"`
|
||||
// 云产品资源 ID 数组。
|
||||
@@ -46,7 +46,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
|
||||
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
|
||||
}
|
||||
|
||||
client, err := createSDKClient(config.SecretId, config.SecretKey, config.Endpoint, config.Region)
|
||||
client, err := createSDKClient(config.SecretId, config.SecretKey, config.Endpoint, config.ResourceRegion)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not create client: %w", err)
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ type DeployerConfig struct {
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
// 原证书 ID。
|
||||
CertificateId string `json:"certificateId"`
|
||||
// 是否替换原有证书(即保持原证书 ID 不变)。
|
||||
IsReplaced bool `json:"isReplaced,omitempty"`
|
||||
// 云产品地域数组。
|
||||
ResourceRegions []string `json:"resourceRegions,omitempty"`
|
||||
// 云产品类型数组。
|
||||
ResourceProducts []string `json:"resourceProducts"`
|
||||
// 云产品地域数组。
|
||||
ResourceRegions []string `json:"resourceRegions"`
|
||||
// 是否替换原有证书(即保持原证书 ID 不变)。
|
||||
IsReplaced bool `json:"isReplaced,omitempty"`
|
||||
}
|
||||
|
||||
type Deployer struct {
|
||||
|
||||
+7
-7
@@ -38,13 +38,13 @@ const BizDeployNodeConfigFieldsProviderTencentCloudSSLDeploy = () => {
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name={[parentNamePath, "region"]}
|
||||
initialValue={initialValues.region}
|
||||
label={t("workflow_node.deploy.form.tencentcloud_ssldeploy_region.label")}
|
||||
name={[parentNamePath, "resourceRegion"]}
|
||||
initialValue={initialValues.resourceRegion}
|
||||
label={t("workflow_node.deploy.form.tencentcloud_ssldeploy_resource_region.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_ssldeploy_region.tooltip") }}></span>}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_ssldeploy_resource_region.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.tencentcloud_ssldeploy_region.placeholder")} />
|
||||
<Input placeholder={t("workflow_node.deploy.form.tencentcloud_ssldeploy_resource_region.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
@@ -85,7 +85,7 @@ const BizDeployNodeConfigFieldsProviderTencentCloudSSLDeploy = () => {
|
||||
|
||||
const getInitialValues = (): Nullish<z.infer<ReturnType<typeof getSchema>>> => {
|
||||
return {
|
||||
region: "",
|
||||
resourceRegion: "",
|
||||
resourceProduct: "",
|
||||
resourceIds: "",
|
||||
};
|
||||
@@ -96,7 +96,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
|
||||
|
||||
return z.object({
|
||||
endpoint: z.string().nullish(),
|
||||
region: z.string().nonempty(),
|
||||
resourceRegion: z.string().nullish(),
|
||||
resourceProduct: z.string().nonempty(),
|
||||
resourceIds: z
|
||||
.string()
|
||||
|
||||
+23
-23
@@ -46,23 +46,6 @@ const BizDeployNodeConfigFieldsProviderTencentCloudSSLUpdate = () => {
|
||||
<Input placeholder={t("workflow_node.deploy.form.tencentcloud_sslupdate_certificate_id.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name={[parentNamePath, "resourceProducts"]}
|
||||
initialValue={initialValues.resourceProducts}
|
||||
label={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.label")}
|
||||
extra={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.help")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.tooltip") }}></span>}
|
||||
>
|
||||
<MultipleSplitValueInput
|
||||
modalTitle={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.multiple_input_modal.title")}
|
||||
placeholder={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.placeholder")}
|
||||
placeholderInModal={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.multiple_input_modal.placeholder")}
|
||||
separator={MULTIPLE_INPUT_SEPARATOR}
|
||||
splitOptions={{ removeEmpty: true, trimSpace: true }}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name={[parentNamePath, "resourceRegions"]}
|
||||
initialValue={initialValues.resourceRegions}
|
||||
@@ -80,6 +63,23 @@ const BizDeployNodeConfigFieldsProviderTencentCloudSSLUpdate = () => {
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name={[parentNamePath, "resourceProducts"]}
|
||||
initialValue={initialValues.resourceProducts}
|
||||
label={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.label")}
|
||||
extra={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.help")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.tooltip") }}></span>}
|
||||
>
|
||||
<MultipleSplitValueInput
|
||||
modalTitle={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.multiple_input_modal.title")}
|
||||
placeholder={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.placeholder")}
|
||||
placeholderInModal={t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.multiple_input_modal.placeholder")}
|
||||
separator={MULTIPLE_INPUT_SEPARATOR}
|
||||
splitOptions={{ removeEmpty: true, trimSpace: true }}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name={[parentNamePath, "isReplaced"]}
|
||||
initialValue={initialValues.isReplaced}
|
||||
@@ -106,12 +106,6 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
|
||||
return z.object({
|
||||
endpoint: z.string().nullish(),
|
||||
certificateId: z.string().nonempty(),
|
||||
resourceProducts: z
|
||||
.string()
|
||||
.nonempty()
|
||||
.refine((v) => {
|
||||
return v.split(MULTIPLE_INPUT_SEPARATOR).every((e) => !!e.trim());
|
||||
}, t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.errmsg.invalid")),
|
||||
resourceRegions: z
|
||||
.string()
|
||||
.nullish()
|
||||
@@ -119,6 +113,12 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
|
||||
if (!v) return true;
|
||||
return v.split(MULTIPLE_INPUT_SEPARATOR).every((e) => !!e.trim());
|
||||
}, t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_regions.errmsg.invalid")),
|
||||
resourceProducts: z
|
||||
.string()
|
||||
.nonempty()
|
||||
.refine((v) => {
|
||||
return v.split(MULTIPLE_INPUT_SEPARATOR).every((e) => !!e.trim());
|
||||
}, t("workflow_node.deploy.form.tencentcloud_sslupdate_resource_products.errmsg.invalid")),
|
||||
isReplaced: z.boolean().nullish(),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2040,9 +2040,9 @@
|
||||
"placeholder": "Please enter Tencent Cloud SSL API endpoint (e.g. ssl.intl.tencentcloudapi.com)",
|
||||
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>ssl.intl.tencentcloudapi.com</strong> for Tencent Cloud International</li><li><strong>ssl.tencentcloudapi.com</strong> for Tencent Cloud in China</li></ul>"
|
||||
},
|
||||
"tencentcloud_ssldeploy_region": {
|
||||
"label": "Tencent Cloud region",
|
||||
"placeholder": "Please enter Tencent Cloud service region (e.g. ap-guangzhou)",
|
||||
"tencentcloud_ssldeploy_resource_region": {
|
||||
"label": "Tencent Cloud resource region (Optional)",
|
||||
"placeholder": "Please enter Tencent Cloud resource region (e.g. ap-guangzhou)",
|
||||
"tooltip": "For more information, see <a href=\"https://www.tencentcloud.com/document/product/1007/36573\" target=\"_blank\">https://www.tencentcloud.com/document/product/1007/36573</a>"
|
||||
},
|
||||
"tencentcloud_ssldeploy_resource_product": {
|
||||
@@ -2076,19 +2076,6 @@
|
||||
"placeholder": "Please enter Tencent Cloud SSL certificate ID",
|
||||
"tooltip": "For more information, see <a href=\"https://console.cloud.tencent.com/certoverview\" target=\"_blank\">https://console.cloud.tencent.com/certoverview</a>"
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_products": {
|
||||
"label": "Tencent Cloud resource products",
|
||||
"placeholder": "Please enter Tencent Cloud resource products (separated by semicolons)",
|
||||
"errmsg": {
|
||||
"invalid": "Invalid resource products"
|
||||
},
|
||||
"help": "Notes: Multiple values should be separated by semicolons.",
|
||||
"tooltip": "For more information, see <a href=\"https://www.tencentcloud.com/document/product/1007/57981\" target=\"_blank\">https://www.tencentcloud.com/document/product/1007/57981</a> or <a href=\"https://www.tencentcloud.com/document/product/1007/70503\" target=\"_blank\">https://www.tencentcloud.com/document/product/1007/70503</a>",
|
||||
"multiple_input_modal": {
|
||||
"title": "Change Tencent Cloud resource products",
|
||||
"placeholder": "Please enter Tencent Cloud resource product"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_regions": {
|
||||
"label": "Tencent Cloud resource regions (Optional)",
|
||||
"placeholder": "Please enter Tencent Cloud resource regions (separated by semicolons)",
|
||||
@@ -2102,6 +2089,19 @@
|
||||
"placeholder": "Please enter Tencent Cloud resource region"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_products": {
|
||||
"label": "Tencent Cloud resource products",
|
||||
"placeholder": "Please enter Tencent Cloud resource products (separated by semicolons)",
|
||||
"errmsg": {
|
||||
"invalid": "Invalid resource products"
|
||||
},
|
||||
"help": "Notes: Multiple values should be separated by semicolons.",
|
||||
"tooltip": "For more information, see <a href=\"https://www.tencentcloud.com/document/product/1007/57981\" target=\"_blank\">https://www.tencentcloud.com/document/product/1007/57981</a> or <a href=\"https://www.tencentcloud.com/document/product/1007/70503\" target=\"_blank\">https://www.tencentcloud.com/document/product/1007/70503</a>",
|
||||
"multiple_input_modal": {
|
||||
"title": "Change Tencent Cloud resource products",
|
||||
"placeholder": "Please enter Tencent Cloud resource product"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_is_replaced": {
|
||||
"label": "Renewal certificate (certificate ID unchanged)",
|
||||
"tooltip": "When unchecked, it will invoke <em>UpdateCertificateInstance</em>; otherwise, it will invoke <em>UploadUpdateCertificateInstance</em>."
|
||||
|
||||
@@ -2036,9 +2036,9 @@
|
||||
"placeholder": "请输入腾讯云 SSL 接口端点(例如:ssl.tencentcloudapi.com)",
|
||||
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/400/41659\" target=\"_blank\">https://cloud.tencent.com/document/product/400/41659</a><br>国际站用户请填写 <em>ssl.intl.tencentcloudapi.com</em>。"
|
||||
},
|
||||
"tencentcloud_ssldeploy_region": {
|
||||
"label": "腾讯云服务地域",
|
||||
"placeholder": "请输入腾讯云云产品服务地域(例如:ap-guangzhou)",
|
||||
"tencentcloud_ssldeploy_resource_region": {
|
||||
"label": "腾讯云云产品部署地域(可选)",
|
||||
"placeholder": "请输入腾讯云云产品部署地域(例如:ap-guangzhou)",
|
||||
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/400/41659\" target=\"_blank\">https://cloud.tencent.com/document/product/400/41659</a>"
|
||||
},
|
||||
"tencentcloud_ssldeploy_resource_product": {
|
||||
@@ -2072,19 +2072,6 @@
|
||||
"placeholder": "请输入腾讯云原证书 ID",
|
||||
"tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/certoverview\" target=\"_blank\">https://console.cloud.tencent.com/certoverview</a>"
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_products": {
|
||||
"label": "腾讯云云产品资源类型",
|
||||
"placeholder": "请输入腾讯云云产品资源类型(多个值请用半角分号隔开)",
|
||||
"errmsg": {
|
||||
"invalid": "无效的云产品资源类型"
|
||||
},
|
||||
"help": "提示:支持多个类型,以半角分号隔开。",
|
||||
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/400/91649\" target=\"_blank\">https://cloud.tencent.com/document/product/400/91649</a> 或 <a href=\"https://cloud.tencent.com/document/product/400/119791\" target=\"_blank\">https://cloud.tencent.com/document/product/400/119791</a><br>注意,这两个接口的所支持的云产品资源类型有所不同,具体请查看腾讯云官方文档。",
|
||||
"multiple_input_modal": {
|
||||
"title": "修改腾讯云云产品资源类型",
|
||||
"placeholder": "请输入腾讯云云产品资源类型"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_regions": {
|
||||
"label": "腾讯云云产品部署地域(可选)",
|
||||
"placeholder": "请输入腾讯云云产品部署地域(多个值请用半角分号隔开)",
|
||||
@@ -2098,6 +2085,19 @@
|
||||
"placeholder": "请输入腾讯云云产品部署地域"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_resource_products": {
|
||||
"label": "腾讯云云产品资源类型",
|
||||
"placeholder": "请输入腾讯云云产品资源类型(多个值请用半角分号隔开)",
|
||||
"errmsg": {
|
||||
"invalid": "无效的云产品资源类型"
|
||||
},
|
||||
"help": "提示:支持多个类型,以半角分号隔开。",
|
||||
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/400/91649\" target=\"_blank\">https://cloud.tencent.com/document/product/400/91649</a> 或 <a href=\"https://cloud.tencent.com/document/product/400/119791\" target=\"_blank\">https://cloud.tencent.com/document/product/400/119791</a><br>注意,这两个接口的所支持的云产品资源类型有所不同,具体请查看腾讯云官方文档。",
|
||||
"multiple_input_modal": {
|
||||
"title": "修改腾讯云云产品资源类型",
|
||||
"placeholder": "请输入腾讯云云产品资源类型"
|
||||
}
|
||||
},
|
||||
"tencentcloud_sslupdate_is_replaced": {
|
||||
"label": "是否更新原证书(即证书 ID 保持不变)",
|
||||
"tooltip": "不勾选时,将调用腾讯云 OpenAPI <em>UpdateCertificateInstance</em> 接口;否则,将调用腾讯云 OpenAPI <em>UploadUpdateCertificateInstance</em> 接口。"
|
||||
|
||||
Reference in New Issue
Block a user