-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add Module specific configuration and more error checking into config file #23
Comments
this could be passed to any functions marked with the onload wrapper when a module is being loaded. would require a slight change to the wrapper, and a change to the plugin loading system, but it shouldn't be too difficult. |
Perhaps it could be a little more clever. With a dict along the lines of {
/* other config lines ... */
"Plugins": [
"markov" : {
"DBName" : "markov"
},
"seval" : {
"timeout" : 3
}
]
} You can name custom dicts to pass into each plugin as a config rather than passing the whole thing as a global -- this would keep the data compartmentalised and prevent plugins from being able to access configs they don't have any business reading (reduces exploitation surface area if nothing else). |
also allowing plugins to write back to the config might be interesting |
Perhaps a the plugins could keep the same dict of settings about, and a |
performing an update on the settings would probably be better, so if no settings are returned keep current ones, else replace any settings with the ones returned. and maybe a None value to unset the setting? |
I think that over complicates the problem, doesn't it? |
every plugin that would use a config would have to return all it's settings again, which sounds like a lot of hassle if it has many settings |
It would just need a generalised method which returns the settings. It could be done up in the wrapper. |
And if the settings themselves are a dict, it's not like you'd need 1000 different fields in the plugin. It'd just be bar = self.settings["key"]
self.settings["key"] = foo |
plugin receives |
what is this, fucking Erlang? config() ->
receive
{"mode", "simple"} -> simple_mode();
All -> set_config(All)
end. |
#2 being fixed now means we can specify servers, and logins in a non-code file, which is nice. However it's a little fragile and doesn't have all the defaults it should.
It would also be nice if you could pass through configs to various plugins. E.g. mongo db settings to
markov
, again with sensible defaults.Similarly it should be extensible. Potentially with a global list of API keys, accessible by other plugins to safely grab a key without needing to in-line it in code, or have a custom solution.
This could also be per-server, where instead of a list of auto-load plugin names, there's a list of plugin configs.
The text was updated successfully, but these errors were encountered: