Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all reads on configuration_hash use methods #37280

Merged
merged 1 commit into from Sep 24, 2019

Conversation

seejohnrun
Copy link
Member

Convert all uses of db_config.configuration_hash[*] to use methods
defined on an implementation of DatabaseConfigurations::DatabaseConfig.

Since we want to get away from accessing properties directly on the
underlying configuration hash, we'll move here to accessing those values
via the implementations on DatabaseConfig (or more specifically,
HashConfig).

There are still codepaths that are passing around configuration_hash,
and follow-on PRs will address those with the goal of using
configuration objects everywhere up until the point we pass a resolved
hash over to the underlying client.

cc / @eileencodes

@seejohnrun seejohnrun changed the title Make all writes on configuration_hash use methods Make all reads on configuration_hash use methods Sep 23, 2019
Convert all uses of `db_config.configuration_hash[*]` to use methods
defined on an implementation of `DatabaseConfigurations::DatabaseConfig`.

Since we want to get away from accessing properties directly on the
underlying configuration hash, we'll move here to accessing those values
via the implementations on `DatabaseConfig` (or more specifically,
`HashConfig`).

There are still codepaths that are passing around `configuration_hash`,
and follow-on PRs will address those with the goal of using
configuration objects everywhere up until the point we pass a resolved
hash over to the underlying client.

Co-authored-by: eileencodes <eileencodes@gmail.com>
@eileencodes eileencodes merged commit ddc73ed into rails:master Sep 24, 2019
@eileencodes eileencodes deleted the use-db-config branch September 24, 2019 12:08
seejohnrun added a commit to seejohnrun/rails that referenced this pull request Sep 24, 2019
Instead of introducing individual methods for every property on `configuration_hash`,
we're aiming to maintain that we only define methods for properties
related to how Rails will _use_ a connection (adapter, spec, env,
replica?) and not the database connection information itself.

To that end, we're reverting rails#37280 which introduced methods specific to
connection properties like `pool`, `idle_timeout`, and `database`.

This reverts commit b8b2d40.

Co-authored-by: eileencodes <eileencodes@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants