Skip to content

Add Config.read_config/1 #13754

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

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Add Config.read_config/1 #13754

merged 2 commits into from
Aug 27, 2024

Conversation

josevalim
Copy link
Member

No description provided.

@josevalim
Copy link
Member Author

A potential question we could have here is if we should mirror the functionality in Application. If we were to follow their API, we would have:

  • read_all_config(root_key)
  • read_config(root_key, path)

The reason I chose only a single read_config/1 is to give more control to the user. Although the path one can be a bit more convenient, I don't foresee many use cases anyway. I want to make it explicitly distinct from the application one (as to avoid any confusion that they are related) and also because they have different performance implications. get_all_env, for example, performs multiple ETS reads.

If we want, in the future, we could add: read_config(root_key, path) and bang versions for both.

Copy link
Contributor

@sabiwara sabiwara left a comment

Choose a reason for hiding this comment

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

LGTM

@josevalim josevalim merged commit 14595bb into main Aug 27, 2024
18 checks passed
@josevalim josevalim deleted the jv-read-config branch August 27, 2024 02:08
@josevalim
Copy link
Member Author

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants