Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support :connect_opts_proc Database option for late binding options
Some modern authentication schemes automatically rotate usernames and/or passwords on a regular basis without user involvement or control. Attempt to support this type of authentication case with this option, so you can do something like: Sequel.connect('postgres://user@host/database', connect_opts_proc: lambda do |h| h[:password] = SomeAuthLibrary.get_current_password(h[:user]) end) The way this is implemented, the :connect_opts_proc is always called before a new connection is made, so directly before the connection is made, it will get the current password for the account. Note that for the jdbc adapter, because it generally works directly on JDBC URIs, the :connect_opts_proc should probably set the :uri key in the hash appropriately.
- Loading branch information