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

Move IdentityConfig code into Identity::Hostdata #10476

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

zachmargolis
Copy link
Contributor

See 18F/identity-hostdata#39

Big rename of IdentityConfig.store to Identity::Hostdata.config

Lets us share code with other repos, as this code has been copy-pasted quite a few times now

@zachmargolis zachmargolis requested a review from a team April 22, 2024 17:00
@zachmargolis
Copy link
Contributor Author

zachmargolis commented Apr 22, 2024

Most of the changes are automated, but this touches the entire codebase, so merge conflicts are kind of inevitable, my strategy is going to be to:

  1. Reset to main
  2. Keep manual changes to files:
    • config/application.rb
    • lib/tasks/check_for_pending_migrations.rake
  3. Re-apply automated conversion
    • git grep -l IdentityConfig.store | xargs perl -p -i -e 's/IdentityConfig.store/Identity::Hostdata.config/g'
    • bundle exec rubocop --autocorrect

@zachmargolis zachmargolis marked this pull request as ready for review April 22, 2024 23:20
- Allows for better sharing across codebases
- Keeps "IdentityConfig.store" around to forward, which allows
  keeping old syntax for now

changelog: Internal, Source code, Use shared logic for accessing config data
@zachmargolis zachmargolis force-pushed the margolis-identity-hostdata-config branch from 897f3ee to 72a4478 Compare April 23, 2024 15:39
Comment on lines +12 to 14
def self.store
Identity::Hostdata.config
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this shorthand and redid the PR to minimize diff noise

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏


config.asset_sources = AssetSources.new(
manifest_path: Rails.public_path.join('packs', 'manifest.json'),
cache_manifest: Rails.env.production? || Rails.env.test?,
i18n_locales: IdentityConfig.store.available_locales,
i18n_locales: Identity::Hostdata.config.available_locales,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now basically the only file that's been migrated to the new syntax

Copy link
Member

@Sgtpluck Sgtpluck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't know much about this code, but i found this pretty easy to follow. lgtm, with one small non-blocking thought.

Comment on lines +12 to 14
def self.store
Identity::Hostdata.config
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@@ -32,24 +32,24 @@ class Application < Rails::Application
Identity::Hostdata.logger.level = log_level
end

configuration = Identity::Hostdata::ConfigReader.new(
Identity::Hostdata.load_config!(
app_root: Rails.root,
logger: Identity::Hostdata.logger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big deal, but you could skip passing in the logger value as it evokes as
logger: logger || self.logger

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah great reminder! updated in 7d3ed90

zachmargolis and others added 2 commits April 25, 2024 08:46
Co-authored-by: Davida Marion <sgtplt@users.noreply.github.com>
@zachmargolis zachmargolis merged commit 7ff6163 into main Apr 25, 2024
2 checks passed
@zachmargolis zachmargolis deleted the margolis-identity-hostdata-config branch April 25, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants