Correctly update environment secrets

This commit is contained in:
Brian Zoetewey 2024-11-14 15:25:09 -05:00
parent f9746215ef
commit 3b156a59b9

View File

@ -50,11 +50,18 @@ func updateEnvironmentSecrets(store db.Store, env db.Environment) error {
continue
}
err = store.UpdateAccessKey(db.AccessKey{
Name: string(secret.Type) + "." + secret.Name,
String: secret.Secret,
Type: db.AccessKeyString,
})
updateKey := db.AccessKey{
ID: key.ID,
ProjectID: key.ProjectID,
Name: string(secret.Type) + "." + secret.Name,
Type: db.AccessKeyString,
}
if secret.Secret != "" {
updateKey.String = secret.Secret
updateKey.OverrideSecret = true
}
err = store.UpdateAccessKey(updateKey)
}
}