Skip to content

Commit

Permalink
Fix a panic when creating HVS app or secret (#1154)
Browse files Browse the repository at this point in the history
* Add guards before accessing a pointer

* add changelog

* reanem changelog file

* update changelog
  • Loading branch information
divyapola5 authored Dec 16, 2024
1 parent 7ce6feb commit 29db09e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/1154.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Fix a panic when creating HVS app or secret
```
16 changes: 11 additions & 5 deletions internal/clients/vault_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ func CreateVaultSecretsApp(ctx context.Context, client *Client, loc *sharedmodel

createParams := secret_service.NewCreateAppParams()
createParams.Context = ctx
createParams.Body.Name = appName
createParams.Body.Description = description
createParams.Body = &secretmodels.SecretServiceCreateAppBody{
Name: appName,
Description: description,
}
createParams.OrganizationID = loc.OrganizationID
createParams.ProjectID = loc.ProjectID

Expand Down Expand Up @@ -57,7 +59,9 @@ func UpdateVaultSecretsApp(ctx context.Context, client *Client, loc *sharedmodel
updateParams := secret_service.NewUpdateAppParams()
updateParams.Context = ctx
updateParams.Name = appName
updateParams.Body.Description = description
updateParams.Body = &secretmodels.SecretServiceUpdateAppBody{
Description: description,
}
updateParams.OrganizationID = loc.OrganizationID
updateParams.ProjectID = loc.ProjectID

Expand Down Expand Up @@ -92,8 +96,10 @@ func CreateVaultSecretsAppSecret(ctx context.Context, client *Client, loc *share
createParams := secret_service.NewCreateAppKVSecretParams()
createParams.Context = ctx
createParams.AppName = appName
createParams.Body.Name = secretName
createParams.Body.Value = secretValue
createParams.Body = &secretmodels.SecretServiceCreateAppKVSecretBody{
Name: secretName,
Value: secretValue,
}
createParams.OrganizationID = loc.OrganizationID
createParams.ProjectID = loc.ProjectID

Expand Down

0 comments on commit 29db09e

Please sign in to comment.