Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins configuration storage #4

Closed
scabala opened this issue Aug 11, 2021 · 3 comments · Fixed by #6
Closed

Plugins configuration storage #4

scabala opened this issue Aug 11, 2021 · 3 comments · Fixed by #6

Comments

@scabala
Copy link
Contributor

scabala commented Aug 11, 2021

This is enhancement to application code.
Right now, it is only possible to store configuration for plugins that are bundled with app itself - the list is defined at catapult.conf.DEFAULTS. It is then written to XDG_CONFIG_HOME/catapult/catapult.json. During application life, all those configuration options and their changes provided by user are present in catapult.conf module, via setting variables.

There two issues with this approach:

  • storing data in global variable is vulnerable to modifications by any part of program. Plugins can have name conflicts and break each other by accident.
  • configuration of plugins is not stored anywhere so any user modifications are lost on app shutdown.

It can be solved by running some configuration store with proper namespacing for plugins. Also, global variable is required for sharing data between plugins and preference items. I'm not sure if this is good idea, but having preference items more tangled with plugins might solve the need for global configuration store. It would be only needed when there's app shutdown event all data needs to be stored in file.

This issue is more like place for discussion than some solution presentation as I do not have clear vision about config system yet.

@otsaloma
Copy link
Owner

Yeah, this is a work in progress. I just added the ability to put stuff in the preferences dialog, but there's no general mechanism for plugins to save preferences yet.

I probably don't want plugin configuration in the main app configuration store and corresponding config file. It just seems too risky, bad quality plugins could break more than just the single plugin. I likely want each plugin to have their own config file as ~/.config/catapult/plugins/xxx.json and some helper class for that, but I haven't thought through the details yet.

@scabala
Copy link
Contributor Author

scabala commented Aug 19, 2021

I like the idea with separate configuration files for plugins.

I can start hacking with some solution if you it's okay with you.

@otsaloma
Copy link
Owner

I've by now had time to think about this, so I'm more or less committed to a certain way of doing it. If you have thought this through, we can discuss the details, but otherwise, I'll write the code myself soon, the implementation is not much work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants