feat: rename configType/providerType to provider
This commit is contained in:
@@ -152,7 +152,7 @@ func Get(record *models.Record) (Applicant, error) {
|
||||
DisableFollowCNAME: applyConfig.DisableFollowCNAME,
|
||||
}
|
||||
|
||||
return GetWithTypeOption(domain.AccessProviderType(access.GetString("configType")), option)
|
||||
return GetWithTypeOption(domain.AccessProviderType(access.GetString("provider")), option)
|
||||
}
|
||||
|
||||
func GetWithApplyNode(node *domain.WorkflowNode) (Applicant, error) {
|
||||
@@ -174,15 +174,15 @@ func GetWithApplyNode(node *domain.WorkflowNode) (Applicant, error) {
|
||||
DisableFollowCNAME: node.GetConfigBool("disableFollowCNAME"),
|
||||
}
|
||||
|
||||
return GetWithTypeOption(domain.AccessProviderType(access.ConfigType), applyConfig)
|
||||
return GetWithTypeOption(domain.AccessProviderType(access.Provider), applyConfig)
|
||||
}
|
||||
|
||||
func GetWithTypeOption(providerType domain.AccessProviderType, option *ApplyOption) (Applicant, error) {
|
||||
func GetWithTypeOption(provider domain.AccessProviderType, option *ApplyOption) (Applicant, error) {
|
||||
/*
|
||||
注意:如果追加新的常量值,请保持以 ASCII 排序。
|
||||
NOTICE: If you add new constant, please keep ASCII order.
|
||||
*/
|
||||
switch providerType {
|
||||
switch provider {
|
||||
case domain.ACCESS_PROVIDER_ACMEHTTPREQ:
|
||||
return NewACMEHttpReqApplicant(option), nil
|
||||
case domain.ACCESS_PROVIDER_ALIYUN:
|
||||
@@ -206,7 +206,7 @@ func GetWithTypeOption(providerType domain.AccessProviderType, option *ApplyOpti
|
||||
case domain.ACCESS_PROVIDER_VOLCENGINE:
|
||||
return NewVolcEngineApplicant(option), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported applicant provider type: %s", providerType)
|
||||
return nil, fmt.Errorf("unsupported applicant provider type: %s", provider)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import "time"
|
||||
|
||||
type Access struct {
|
||||
Meta
|
||||
Name string `json:"name" db:"name"`
|
||||
ConfigType string `json:"configType" db:"configType"`
|
||||
Config string `json:"config" db:"config"`
|
||||
Usage string `json:"usage" db:"usage"`
|
||||
DeletedAt time.Time `json:"deleted" db:"deleted"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Provider string `json:"provider" db:"provider"`
|
||||
Config string `json:"config" db:"config"`
|
||||
Usage string `json:"usage" db:"usage"`
|
||||
DeletedAt time.Time `json:"deleted" db:"deleted"`
|
||||
}
|
||||
|
||||
type AccessProviderType string
|
||||
|
||||
@@ -30,10 +30,10 @@ func (a *AccessRepository) GetById(ctx context.Context, id string) (*domain.Acce
|
||||
CreatedAt: record.GetTime("created"),
|
||||
UpdatedAt: record.GetTime("updated"),
|
||||
},
|
||||
Name: record.GetString("name"),
|
||||
ConfigType: record.GetString("configType"),
|
||||
Config: record.GetString("config"),
|
||||
Usage: record.GetString("usage"),
|
||||
Name: record.GetString("name"),
|
||||
Provider: record.GetString("provider"),
|
||||
Config: record.GetString("config"),
|
||||
Usage: record.GetString("usage"),
|
||||
}
|
||||
return rs, nil
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ func (d *deployNode) Run(ctx context.Context) error {
|
||||
DeployConfig: domain.DeployConfig{
|
||||
Id: d.node.Id,
|
||||
Access: access.Id,
|
||||
Type: d.node.GetConfigString("providerType"),
|
||||
Type: d.node.GetConfigString("provider"),
|
||||
Config: d.node.Config,
|
||||
},
|
||||
}
|
||||
|
||||
deploy, err := deployer.GetWithTypeAndOption(d.node.GetConfigString("providerType"), option)
|
||||
deploy, err := deployer.GetWithTypeAndOption(d.node.GetConfigString("provider"), option)
|
||||
if err != nil {
|
||||
d.AddOutput(ctx, d.node.Name, "获取部署对象失败", err.Error())
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user