strapi-plugin-config-sync icon indicating copy to clipboard operation
strapi-plugin-config-sync copied to clipboard

Forbid synced configs to be edited in Admin panel

Open goodhoko opened this issue 2 years ago • 3 comments

Feature request

Summary

Add an option that makes it impossible to edit configs eligible for exporting from the Admin panel.

Why is it needed?

I'm using the config-sync plugin as outlined in the Workflow section of its documentation. I.e. I alter the configs locally, check the changes into git, and then import them on remote (staging/prod) environments.

Since my deploys to remote envs are fully automated I'm taking advantage of the importOnBootstrap option to import the changes automatically with every deploy. This causes any changes in the DB to be overwritten. This is ultimately correct, as the developer's (and hence the imported) config version should be the source of truth. However it can still cause confusion and/or trouble as users using the Admin panel may not know/understand their changes will disappear with the next deploy.

Suggested solution(s)

The optimal solution is to have an option in the plugin's config that, when set to true, prevents any writes to configs eligible for exporting. This option can then be set depending on the environment.

Indicating that a config is locked in the Admin Panel GUI would be very nice, but simply returning an error after submit would work too, IMO.

goodhoko avatar Sep 04 '22 09:09 goodhoko

Hi @goodhoko.

Thanks for yet another great feature request. IMO this is definitely something thats benefitial for the future of the plugin.

I'm not sure if we have that much control from within a plugin. Changing the layout of other plugins (the lock indication) is something I surely know is not possible (yet).

For returning an error when trying to update locked settings I think we have to write some kind of middleware. The middleware will check the request and if it is one that is locked, and the lock setting is set to true, it will act as an interference for finishing the request.

boazpoolman avatar Sep 05 '22 09:09 boazpoolman

+1. We use this feature to import configs for different API's. We are running into this issue so we are not using the importOnBootstrap feature.

One example:

  • We have a table with e-mail templates. In our dev, we export staging/production ready email templates.
  • We'd like to use importOnBootstrap on staging/production, which would be ideal for a first run.
  • Now we change an imported template in staging or production
  • On the next run, importOnBootstrap overrides the customized template with the dev template.

So basically, if the state is Different for a template, we would like to have that entry skipped by importOnBootstrap. We only like to import the state Only in sync dir with importOnBootstrap.

BabyDino avatar Oct 13 '22 12:10 BabyDino

@BabyDino That seems like a nice suggestion! I feel like it is a different feature then issue #68. Could you maby create a new issue for this? It's def something I could do within short term. I would suggest having a new boolean setting like soft. If that is set to true it will only import new config, not update or delete current ones. Love it!

boazpoolman avatar Oct 17 '22 10:10 boazpoolman