-
Notifications
You must be signed in to change notification settings - Fork 123
Check+manipulate plugin config at mount time #559
Comments
This would be very helpful for the |
unfortunately not this release, @petermax2 do you have resources to do it? Let us talk about it tomorrow. |
|
I understand the concept of Is this a good location for calling
While adding each plugin to the backend, every plugin exporting the Or would you rather introduce a new method within the
|
Yeah, I know its a bit tricky because the BackendBuilders are quite nested and helpful documentation is missing. Actually, both of your suggestions are sound and useful. From usability point of view
|
Is there a way to retrieve the exported symbols (provided by the plugin) from At the place where |
No, you have to create a plugin. Please abstract the getSymbol in the pluginDatabase. Both status and lookupInfo already create plugins, it is a one-liner. The pluginDatabase abstraction is useful for both unit tests and to make it easier in future to avoid the many plugin creations. (If you feel like it, you can make that optimization, too.) |
Alright, I'll try. Thank you for the quick response! |
see ElektraInitiative#559 for details
I added an example |
Thank you! Can you write "this function is optional" to other optional functions, too? (open, close, error, set) I think "if the export symbol "exports/checkconf" is provided" is not needed there, because the symbol is already provided in the template. Its easer to give feedback on a PR, though. Following parts should mention it:
|
see ElektraInitiative#559 for details
I propose to add a functionality that plugins can validate or even manipulate their configuration at mount time. We already use that for the resolver (
checkfile
) and it turns out that such feature is essential for thecrypto
plugin which needs to encrypt a password at mount time.We could introduce following convention for plugins: Whenever a plugin exports the symbol checkconf (using
exports/checkconf
), this function with the signatureint checkconf (Key * errorKey, KeySet * config)
will be called.Alternative: Add a pseudo-key
/checkconf
tokdbOpen
which will then switchkdbOpen
to a configuration validator and does not actually open the plugin. This alternative, however, might overloadkdbOpen
too much. (It already has the/modules
feature to open a plugin even though it has no config.)Within
checkconf
plugins can validate their proposed configuration and reject it if unfeasible. E.g. when a user passes a ID for a public key,checkconf
tries to encrypt with it. If it does not work, it would return-1
and set an error (and propose valid IDs within the error message). Then the user can retry with a different ID. Furthermore,checkconf
can manipulate its config, i.e. it can add an encrypted random-generated value as needed for thecrypto
plugin.@petermax2: what do you think?
The text was updated successfully, but these errors were encountered: