Skip to content

Commit

Permalink
Merge branch '2-11-stable' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jan 23, 2025
2 parents 1553c8a + 4a0784d commit 4eb4dc3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions services/project/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,20 @@ func (e BackupTemplate) Restore(store db.Store, b *BackupDB) error {

if e.Vaults != nil {
for _, vault := range e.Vaults {
var VaultKeyID int
if vault.VaultKeyID != nil {
var VaultKeyID *int

if vault.VaultKey != nil {
if k := findEntityByName[db.AccessKey](vault.VaultKey, b.keys); k == nil {
return fmt.Errorf("vaults[].vaultKey does not exist in keys[].name")
} else {
VaultKeyID = k.ID
VaultKeyID = &k.ID
}
}

tplVault := vault.TemplateVault
tplVault.ProjectID = b.meta.ID
tplVault.TemplateID = newTemplate.ID
tplVault.VaultKeyID = &VaultKeyID
tplVault.VaultKeyID = VaultKeyID

_, err := store.CreateTemplateVault(tplVault)
if err != nil {
Expand Down

0 comments on commit 4eb4dc3

Please sign in to comment.