-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Extract common database defaults; better use of YAML #12292
Conversation
Let me know if your'e interested in changes in the explanatory text, or if you want more of the common language across the different templates extracted or abstracted. |
It would be really super great if when a rails core member reviews this s/he assigns someone to it... |
/cc @fxn |
@senny @fxn @tenderlove thoughts? |
On one hand, in my experience it is quite common that different environments share some subset of the configuration. In that sense this edit could be statistically convenient (so to speak). But on the other hand, it is a smell for me that we need comments to explain to users what's that. The comments are justified because this YAML feature is maybe not so widely known, but that defeats the whole simplification goal in my view, you've only moved the problem. There's redundancy in the current generated YAML, but it is trivial to understand, needs no comments. So while I sympathize with the proposal, I am not really positive about it. |
@fxn thanks for following up. I wrote this PR because I find myself extracting common configs on every project. This was also featured in Rails Recipe and in a recent post by EnvyLabs also sent in the RubyWeekly. So, there is definitely traction for the idea. I see the comments as furthering an understanding of a data serialization format that's been popular in Ruby since before _why wrote libsyck in 2003. I think there is a need to better understand that YAML is more than JSON, and to make use of that for greater developer happiness. Would you like, perhaps, the PR implemented differently, to be just a comment, but no code change, or perhaps no comments? |
@bf4 from my perspective, the PR would be better without meta comments about YAML, just refactor. It can be argued that if your config is YAML, you have to know YAML. |
I'll remove, amend, and force push later tonight. Thanks for your attention |
@fxn Updated to remove comments and rebased off of master |
Good to go, thanks for working on this! |
Extract common database defaults; better use of YAML
And thanks for following up @fxn! |
While dev and test databases often share their settings, production, from my experience, usually has different host and credentials. So besides getting a more cryptic config, there doesn't seem to be any other advantages. |
Your production config will just override a couple of the keys typically. |
@bf4 in principle this change wouldn't need extra documentation in my opinion (other than sync'ing examples to match the file, if there were any). |
Followed by #27611 |
Use the power of YAML in the database configurations to better express adapter concerns versus environment concerns. Also see https://github.com/bf4/yaml_resources/blob/master/recipes/rails_database_configuration.md