优化结构
This commit is contained in:
@@ -156,6 +156,7 @@ func (r *integrationConfigRepo) SaveIntegrationConfig(ctx context.Context, confi
|
||||
err := db.Where("kind = ? AND provider = ?", config.Kind, config.Provider).First(&row).Error
|
||||
values := integrationObject(config.Values)
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
mergeIntegrationSecrets(config.Kind, config.Provider, values, map[string]any{})
|
||||
if config.Enabled {
|
||||
if err = integrationbiz.ValidateIntegrationConfig(config.Kind, config.Provider, values); err != nil {
|
||||
return err
|
||||
@@ -233,6 +234,13 @@ func maskIntegrationSecrets(kind, provider string, values map[string]any) {
|
||||
if nested, ok := value.(map[string]any); ok {
|
||||
maskIntegrationSecrets(kind, provider, nested)
|
||||
}
|
||||
if nested, ok := value.([]any); ok {
|
||||
for _, item := range nested {
|
||||
if child, ok := item.(map[string]any); ok {
|
||||
maskIntegrationSecrets(kind, provider, child)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user