-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(lexicon): configurable presets #53449
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
Conversation
nickvergessen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving my technical comment to the Draft PR, as the issue is more focused on the "content".
I'm not a fan of the approach proposed here and in #51804 (comment) as it's very focused on server and shipped apps.
We need to have the modes given as a constant and should then have a way for each config in it's Lexicon to have a different fall back, so this can be properly done by non-shipped apps as well.
The nested PHP array in a simple file is way to dangerous to have a typo or something sneak in.
So from my POV the "presets" should be handled on each individual entry of the ConfigLexiconEntry with an optional defaultPresetArray array parameter that has the preset name as key and the respective default as a value.
This also allows apps to properly define the config keys within their app without having to wait for a server release, etc. which is very important for apps being released independently or spanning over multiple different server versions.
I really like this idea, but I would like to advocate for both solution. with a priority on the PHP array.
We could run a check on request (when a new preset is selected, background job, via occ command)
This or a new specific method in
We can assume that a change of value type means a change of the key name. |
This is/was not the main idea of the presets. If you want to share a subset of your configuration you can already do that by simply creating a JSON and importing it with
This is and should be controlled by server, so the preset from app's side don't need to handle this.
Default could be a callback that receives the preset?
We are not speaking about config type changes, but let's say Talk introduced a new config in the Summit release first week of June (and we actually had 4), we would need to require people to update server first/as well, before the matching defaults would be available. The main goal is to assist admins with a good experience and developing an own preset is not one of them. It's more important that apps can provide good/sane defaults for known cases out of the box, without having to take loops through server releases. |
2294ff1 to
8e1cf04
Compare
|
@nickvergessen : I changed the approach Preset are an Enom and the syntax will use its own method:
First argument can be an array of
|
|
@nickvergessen beside the dot ( |
8e1cf04 to
c4284a4
Compare
6832d54 to
cd054cc
Compare
nickvergessen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it goes into a better direction now. Can improve the coding experience a bit more :)
1e99307 to
859f630
Compare
859f630 to
78fa1a4
Compare
|
@nickvergessen what about having a second parameter as reference in the Closure that store the returned value in database if set to instead of using |
|
Hmm not sure, I see how it could save calculation efforts, but increases complexity again. All arrays don't have a default that'd depend on preset, most are empty by default. |
bd87605 to
937bb76
Compare
nickvergessen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about the command, otherwise it looks good to go
f3623e8 to
d453c9a
Compare
Signed-off-by: Maxence Lange <[email protected]>
d453c9a to
e64be71
Compare
can you please remove your change request ? ;-) |
nickvergessen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Required for: #51804
status: review ready.
$defaultRawparameter fromConfigLexiconEntryto set default value based on selectedPresetinconfig.phpusing'config_preset'./occ config:preset [<new_preset>]