Skip to content

Dynamic password change #2513

@vitaly-t

Description

@vitaly-t

What is the recommended approach to dealing with passwords that can change dynamically?

At first, I saw this PR, only to find out it is actually useless for this, as it only invokes the callback once, in the beginning. In my case, the password can change at any point, and the pool connection needs to be updated accordingly.

At first, I tried destroying and then re-creating the pool, but this seemed too radical, and awkward, having to track authentication issues to figure out when to re-create the pool.

Then I tried setting pool.options.password = 'new-password' whenever I was about to reuse the pool object. But this would only work when a connection object was used. For a connection string, I had to re-generate the string, and set it to pool.options.connectionString before every use of the pool.

This all looks like a hack. Is there a recommended approach to updating the pool with the new password?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions