Alerting: Remove dependency on secrets in definitions package (#65391)

This commit is contained in:
Yuri Tseretyan
2023-03-27 16:35:54 -04:00
committed by GitHub
parent c94760e844
commit ec4152c7e5
3 changed files with 10 additions and 5 deletions
+4 -1
View File
@@ -19,6 +19,7 @@ import (
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/services/ngalert/notifier"
"github.com/grafana/grafana/pkg/services/ngalert/store"
"github.com/grafana/grafana/pkg/services/secrets"
"github.com/grafana/grafana/pkg/util"
)
@@ -267,7 +268,9 @@ func (srv AlertmanagerSrv) RoutePostTestReceivers(c *contextmodel.ReqContext, bo
return ErrResp(http.StatusInternalServerError, err, "")
}
if err := body.ProcessConfig(srv.crypto.Encrypt); err != nil {
if err := body.ProcessConfig(func(ctx context.Context, payload []byte) ([]byte, error) {
return srv.crypto.Encrypt(ctx, payload, secrets.WithoutScope())
}); err != nil {
return ErrResp(http.StatusInternalServerError, err, "failed to post process Alertmanager configuration")
}