I'm implementing a role which can be configured. For the better user experience I'd like to make it's default configuration explicit so that a user could simply edit it in Cartridge WebUI.
But cartridge.config_patch_clusterwide
isn't suitable for this purpose because it calling it from init()
callback results in recursing and thus prohibited.
Is there any other way to accomplist it?
There is
on_patch
trigger, which could do it. Here is API reference: https://www.tarantool.io/en/doc/latest/book/cartridge/cartridge_api/modules/cartridge.twophase/#on-patch-trigger-new-trigger-oldYour role could look like follows:
Before every update of clusterwide configuration cartridge will call the trigger, so the role can modify it if necessary. Be careful not to spoil it.