Skip to content

Commit bc37c88

Browse files
committed
database: don't store database credentials secret in the database
This would be too confusing: you'd be able to update the secret in the database, via the HTTP API, but it would not have an effect, since the credentials used for the database are only consumed on service startup. Signed-off-by: Stephan Renatus <[email protected]>
1 parent 94c0c32 commit bc37c88

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/database/database.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,12 @@ func (d *Database) LoadConfig(ctx context.Context, bar *progress.Bar, principal
511511

512512
// Secrets have env lookups done on access, without the secret value persisted in the databse.
513513
for _, secret := range root.SortedSecrets() {
514+
if root.Database != nil && root.Database.SQL != nil && root.Database.SQL.Credentials != nil {
515+
// check if this secret is used for the database, omit it if true
516+
if secret.Ref().Equal(root.Database.SQL.Credentials) {
517+
continue
518+
}
519+
}
514520
if err := d.UpsertSecret(ctx, principal, secret); err != nil {
515521
return fmt.Errorf("upsert secret %q failed: %w", secret.Name, err)
516522
}

0 commit comments

Comments
 (0)