Skip to content

Commit

Permalink
remove block replaced by helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
j-white committed Apr 18, 2024
1 parent b350615 commit 36f968d
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions internal/datastore/mysql/migrations/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ func NewMySQLDriverFromDSN(url string, tablePrefix string, credentialsProvider d
return nil, fmt.Errorf(errUnableToInstantiate, err)
}

if credentialsProvider != nil {
log.Debug().Str("name", credentialsProvider.Name()).Msg("using credentials provider")
// we must transmit the token over the connection, and not a hash
dbConfig.AllowCleartextPasswords = true
// add a before connect callback to trigger the token retrieval from the credentials provider
err := dbConfig.Apply(sqlDriver.BeforeConnect(func(ctx context.Context, config *sqlDriver.Config) error {
config.User, config.Passwd, err = credentialsProvider.Get(ctx, config.Addr, config.User)
return err
}))
if err != nil {
return nil, fmt.Errorf(errUnableToInstantiate, err)
}
}

connector, err := sqlDriver.NewConnector(dbConfig)
if err != nil {
return nil, fmt.Errorf(errUnableToInstantiate, err)
Expand Down

0 comments on commit 36f968d

Please sign in to comment.