Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Add suggestions from review.

Co-authored-by: Silvestre Zabala <[email protected]>
  • Loading branch information
joergdw and silvestre authored Aug 16, 2024
1 parent b36d811 commit 96e53fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/autoscaler/db/sqldb/storedprocedure_sqldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ func (sdb *StoredProcedureSQLDb) ValidateCredentials(ctx context.Context, creds
// “cred_helper/storedprocedure_cred_helper.go” – we store in each column just the corresponding
// app_id. To “mark that”, we use here the `as app_id`-renaming.
query := fmt.Sprintf(
"SELECT instance_id as app_id, binding_id from %s($1,$2) WHERE binding_id = $3",
"SELECT instance_id as app_id, binding_id from %s($1,$2) WHERE app_id = $3",
procedureIdentifier.Sanitize())
err := sdb.sqldb.QueryRow(ctx, query, creds.Username, creds.Password, appId).
Scan(&credOptions.InstanceId, &credOptions.BindingId)

if err == pgx.ErrNoRows {
sdb.logger.Error(
sdb.logger.Info(
"user found but does not own the app behind the binding",
err, lager.Data{"query": query, "creds": creds, "appId": appId})

return nil, errors.New("user found but does not own the app")
} else if err != nil {
sdb.logger.Error(
"validate-stored-procedure-credentials",
"credential-validation-with-stored-function-errored",
err, lager.Data{"query": query, "creds": creds, "appId": appId})

return nil, err
Expand Down

0 comments on commit 96e53fd

Please sign in to comment.