mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix decrypting in datasource update (#41704)
This commit is contained in:
@@ -294,14 +294,13 @@ func (hs *HTTPServer) fillWithSecureJSONData(ctx context.Context, cmd *models.Up
|
|||||||
return models.ErrDatasourceIsReadOnly
|
return models.ErrDatasourceIsReadOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
secureJSONData, err := hs.SecretsService.DecryptJsonData(ctx, ds.SecureJsonData)
|
for k, v := range ds.SecureJsonData {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range secureJSONData {
|
|
||||||
if _, ok := cmd.SecureJsonData[k]; !ok {
|
if _, ok := cmd.SecureJsonData[k]; !ok {
|
||||||
cmd.SecureJsonData[k] = v
|
decrypted, err := hs.SecretsService.Decrypt(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cmd.SecureJsonData[k] = string(decrypted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user