2024-10-02 17:49:33 +02:00
|
|
|
package db
|
|
|
|
|
|
|
|
type TemplateVault struct {
|
2024-10-05 22:16:25 +02:00
|
|
|
ID int `db:"id" json:"id" backup:"-"`
|
|
|
|
ProjectID int `db:"project_id" json:"project_id" backup:"-"`
|
|
|
|
TemplateID int `db:"template_id" json:"template_id" backup:"-"`
|
|
|
|
VaultKeyID int `db:"vault_key_id" json:"vault_key_id" backup:"-"`
|
2024-10-02 17:49:33 +02:00
|
|
|
Name *string `db:"name" json:"name"`
|
|
|
|
|
|
|
|
Vault *AccessKey `db:"-" json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func FillTemplateVault(d Store, projectID int, templateVault *TemplateVault) (err error) {
|
|
|
|
var vault AccessKey
|
|
|
|
vault, err = d.GetAccessKey(projectID, templateVault.VaultKeyID)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
templateVault.Vault = &vault
|
|
|
|
return
|
|
|
|
}
|