pluginpal/strapi-plugin-config-sync

Allow for selectively INCLUDING config types instead of EXCLUDING via `config/plugins.ts`

Opened this issue · 1 comments

EsGeh commented

Feature request

Summary

Quick summary what's this feature request about.
Allow for selectively including config types via config/plugins.ts.

Why is it needed?

I'd like to be able to only include only very few very specific types to be synchronized, e.g. core-store.plugin_content_manager_configuration_content_types::api::....
With the current config format this is almost impossible, because there is no way to specify what to include, but only what to exclude from the defaults. So in order to include very specific config types, one would have to list "everything else" in the excludedConfig field of the config, which is unpractical, and in many cases impossible.

Suggested solution(s)

  1. Conservative solution:
    Consider entries in customTypes even if they match some pattern listed in excludedConfig. This way you may exclude "everything" by listing all default types in excludedConfig and then explicitly list what you'd like to include via customTypes.

  2. More flexible solution

  • By default: no config types are considered.
  • Redesign plugin config format: Only what is listed inside a field named includedConfig is considered

Related issue(s)/PR(s)

Unknown.

Hi @EsGeh,

Thanks for reporting this issue.
I agree with you that having a way to include specific configs would be beneficial for the plugin.

I would suggest going with solution nr 2.
We would introduce a new config key called include which works alongside of the allready existing excludedConfig and excludedTypes. The config should work the same as the excludedConfig. Having an array of strings which can be just one specific config, or just the start of it to include multiple configs at once. That can be done with the native javascript startsWith function to match the start of a string.

If a specific config is for some reason excluded and included through the different config options, then the exclude options should have priority. So a config that is included and excluded will not be synced with the plugin.

Also this new include config array should be able to be empty. That way everything will be included, just like it works now. That way we preserve backwards compatibility.