feat: support template variables in webhook deployment

This commit is contained in:
Fu Diwei
2025-01-03 23:06:02 +08:00
parent e695c8ee5c
commit 90058b2dae
10 changed files with 97 additions and 57 deletions

View File

@@ -367,23 +367,9 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
}
variables := make(map[string]string)
if deployConfig != nil {
value, ok := deployConfig["variables"]
if ok {
kvs := make([]domain.KV, 0)
bts, _ := json.Marshal(value)
if err := json.Unmarshal(bts, &kvs); err == nil {
for _, kv := range kvs {
variables[kv.Key] = kv.Value
}
}
}
}
deployer, err := providerWebhook.NewWithLogger(&providerWebhook.WebhookDeployerConfig{
Url: access.Url,
Variables: variables,
WebhookUrl: access.Url,
WebhookData: maps.GetValueAsString(deployConfig, "webhookData"),
}, logger)
return deployer, logger, err
}