Update Config Seeding to Include Original Module Settings #601
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pass in the original config settings when appending any custom configs. This will give developers more flexibility with how they want to override configs and make things easier if the module has a complex config structure.
Description
Currently if you want to override a module's settings, you have to copy/paste the original module config struct, in some modules, this could be HUGE. What if you just want to override one key within the config struct without overriding the whole thing?
For example:
Let's say in the above example, you just want to change the
users.requireEmailVerification
setting tofalse
. Normally you would have to copy/paste the entireusers
struct, like this:This could get quite ugly for a large CMS module with tons of nested config structs.
What if there was a better way?
By passing in the original ModuleConfig
settings
to theconfigure()
method, we give developers more flexibility with how they might want to override a module's settings.Given the same example above, with my proposed changes, the developer could do something like this:
In a more complex example, lets say you want to allow top-level key overriding, you could do something like this:
Note: I am happy to make the documentation updates in Gitbook, if I can regain access.