Encrypt git token in insertstruct

This commit is contained in:
2025-03-01 21:59:04 +01:00
parent e89b4a0e14
commit 3ce92322f4
6 changed files with 21 additions and 19 deletions

View File

@@ -19,15 +19,8 @@ func (db *database) CreateWorkspace(workspace *models.Workspace) error {
workspace.SetDefaultSettings()
}
// Encrypt token if present
encryptedToken, err := db.encryptToken(workspace.GitToken)
if err != nil {
return fmt.Errorf("failed to encrypt token: %w", err)
}
workspace.GitToken = encryptedToken
query, err := NewQuery(db.dbType).
InsertStruct(workspace, "workspaces")
InsertStruct(workspace, "workspaces", db.secretsService)
if err != nil {
return fmt.Errorf("failed to create query: %w", err)