| 01:56 | * | cwjustgotdelta[m is now known as cwjustgotdelta[m |
| 05:20 | * | farmBOT has joined |
| 15:48 | mstenta[m] | jgaehring paul121 symbioquine : FYI I can only join the dev call today until 12:30 |
| 18:58 | mstenta[m] | symbioquine paul121 : i may end up honing in the scope of the `farm_update` module that i was telling you about on the dev call... |
| 18:58 | mstenta[m] | there are a few different kinds of config differences that can happen... missing config, inactive config, added config, and overridden config |
| 18:59 | mstenta[m] | i may just focus on reverting overridden config - that's the easiest to detect and revert |
| 18:59 | mstenta[m] | i was hoping i could also handle "missing" and "inactive" (creating configuration that is added to a module after it's installed) - but it's turning out to be tricky |
| 19:00 | mstenta[m] | (and i never really planned on handling "added") |
| 19:00 | mstenta[m] | the tricky part with missing/inactive is mostly on the "inactive" side... |
| 19:01 | mstenta[m] | "missing" config would be config in `config/install`, whereas "inactive" is config in `config/optional` |
| 19:01 | mstenta[m] | it's easy enough to detect and import "missing" config |
| 19:01 | mstenta[m] | but "inactive" requires also determining whether or not all the dependencies are met |
| 19:02 | mstenta[m] | so i may just simplify and only focus on "overridden" config to start |
| 19:02 | mstenta[m] | this means `farm_update` will automatically revert any config that's changed, but if config is added/removed then an update hook will still be necessary |
| 19:05 | paul121[m] | <mstenta[m]> "(and i never really planned on..." <- seems like this should really be an update hook? |
| 19:06 | paul121[m] | is that how other contrib modules would handle adding config? |
| 19:06 | mstenta[m] | oh so "added" is actually the opposite of what you'd think... it means there is *extra* config that you may not want anymore |
| 19:06 | mstenta[m] | so it would be a delete event |
| 19:06 | mstenta[m] | which agreed: should NOT happen automatically... except in a very intentional update hook |
| 19:06 | paul121[m] | oh - just read your last reply haha |
| 19:07 | mstenta[m] | but we can't really determine if it's added by farmOS or added manually |
| 19:07 | mstenta[m] | so not gonna touch that with `farm_update` |
| 19:07 | mstenta[m] | (if a farmOS module removes config for some reason, then that module can add an update hook to delete it if that makes sense) |
| 19:07 | paul121[m] | hmmm yep |
| 19:08 | mstenta[m] | the missing/inactive basically means: a module is already installed, but then a new version adds new config in it... since it's already installed, that config will not be automatically created (`config/install` and `config/optional` only get installed when the module is first installed) |
| 19:09 | mstenta[m] | so we *could* potentially automate the creation of that... but i'm finding the "inactive" ones tricky to determine their dependencies |
| 19:09 | paul121[m] | for example, if I manually added a `map_popup` view mode to an asset that did not already have one defined (it was using default), then this would be "added" config |
| 19:09 | mstenta[m] | and it would be weird if we handled "missing" but not "inactive" |
| 19:09 | mstenta[m] | so i might just stick to "overridden" for now |
| 19:10 | mstenta[m] | correct. |
| 19:10 | paul121[m] | gotcha. hmm. there must be some function somewhere that evaluates config dependencies? |
| 19:11 | mstenta[m] | there is |
| 19:11 | mstenta[m] | core has a `config.installer` service |
| 19:11 | paul121[m] | it might be abstracted even lower than config entities - maybe some `DependencyInterface` ? |
| 19:11 | mstenta[m] | with a `validateDependencies` method |
| 19:12 | mstenta[m] | unfortunately, that method is `protected` though, so we can't call it directly from our code |
| 19:12 | paul121[m] | doh |
| 19:12 | mstenta[m] | the code that does call it also installs the config................ maybe we could use the calling method, i can look closer at that as an option... |
| 19:13 | mstenta[m] | otherwise, it would mean replicating that method in our calss |
| 19:13 | mstenta[m] | which is also certainly possible |
| 19:13 | mstenta[m] | but it feels like scope is growing... hence my thought that i'll just focus on reverting overridden |
| 19:14 | mstenta[m] | but maybe it's still worth a look... |
| 19:16 | paul121[m] | does `config.installer` except a list of config to install? or something? |
| 19:23 | mstenta[m] | The `validateDependencies()` method essentially takes a config name + info about installed modules and config |
| 20:57 | mstenta[m] | paul121: should we just remove `config_rewrite`? and just use `hook_install()`? |
| 20:59 | mstenta[m] | we're only using it in `farm_api` (to override `jsonapi`, `jsonapi_extras`, and `simple_oauth` settings), and in `farm_entity` (to override `entity_reference_integrity` settings) |
| 21:00 | mstenta[m] | i'm inclined to just move those overrides to `hook_install()`s in both, and leave those configs unmanaged after installation |
| 21:00 | mstenta[m] | `config_rewrite` is neat, but it does add another layer of complexity, and i'm not sure we absolutely need it |
| 21:01 | mstenta[m] | we were using it for a few other things earlier, but i have converted those to `hook_install()`s already |
| 21:02 | mstenta[m] | (this is related to the `farm_update` considerations... we would need to patch `config_rewrite` so that `config_update` takes rewrites into account) |
| 21:04 | mstenta[m] | if i remember correctly, i think i was the one who pushed using `config_rewrite` originally :-) |
| 21:19 | paul121[m] | ah interesting.. hmm.. yeah it really just is for convenience huh |
| 21:19 | mstenta[m] | i think my main motivation was to keep a high YML/PHP ratio ;-) |
| 21:20 | mstenta[m] | notably, `config/rewrite` ONLY gets evaluated on install (just like `config/install` and `config/optional`) so it's really not much different than `hook_install()` in practice |
| 21:20 | mstenta[m] | and they show as overridden in `config_update_ui` |
| 21:20 | mstenta[m] | so if we move to using `hook_install()` nothing would really change |
| 21:21 | paul121[m] | yea.. right.. it's probably better in `hook_install()` anyways |
| 21:21 | mstenta[m] | and might be better for overall config visibility for end users who want to have more control themselves |
| 21:21 | mstenta[m] | i will probably just exclude all of these configs from `farm_update` reverts either way |
| 21:21 | paul121[m] | it would still show as overridden though, yea? |
| 21:21 | mstenta[m] | yes |
| 21:22 | mstenta[m] | just like it does now |
| 21:22 | paul121[m] | yeah. so I guess some weird situation would be if `simple_oauth` changed its config schema |
| 21:23 | paul121[m] | but we would need to do a `hook_update` for that anyways |
| 21:23 | mstenta[m] | yea true |
| 21:23 | mstenta[m] | also, i noticed we're actually only overriding 3 settings in that one (i've already started the process of moving to `hook_install()` haha) |
| 21:23 | mstenta[m] | the others are the same as defaults |
| 21:24 | mstenta[m] | the two key path settings (which don't have defaults anyway), and `access_token_expiration` (which we increase from 300 to 3600) |
| 21:24 | paul121[m] | ah cool |
| 21:34 | mstenta[m] | want to take a quick look? github.com/farmOS/farmOS/compare/2.x...m |
| 21:40 | paul121[m] | yea looks good! |
| 21:41 | paul121[m] | the `farm_ui_dashboard` and `farm_ui_user` are kinda the kicker that make this seem like the correct way to do things |