errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.13k stars 615 forks source link

Pass default plugin configuration from the config file #1362

Closed bribroder closed 2 years ago

bribroder commented 5 years ago

Hi there,

Presently, plugins like the webserver must be configured after startup by chatting with the bot or running CLI commands. This PR allows a dictionary in the config file to provide defaults to plugins during startup, which improves configuration management and deployment experience.

I think this may also address other requests for plugin config outside of chat, e.g. https://github.com/errbotio/errbot/issues/608

Please let me know what you think of this approach and any ideas for improvement!

sijis commented 5 years ago

Does this mean that every errbot restart the config would get loaded and override any changes through the bot?

bribroder commented 5 years ago

From my testing no, the plugin config options in the database are loaded later and override the config file, which seems like an ok compromise in terms of making it easy to deploy standardized bots without disrupting the chat / db state management

gbin commented 5 years ago

It looks like it overrides all the plugin configs even if you want to override only one.

You need to make a kind of merge in the configs dictionary.

Errbot plugins configs can be set and changed with its command line tool, what feature does this bring compare to it?

bribroder commented 5 years ago

Hey @gbin, could you give me an example of a plugin which behaves badly with this change, when some other options are passed in the config.py file? I think I can add something to assist with merging the config dictionaries but I am having trouble reproducing the problem exactly.

Re: advantages / benefits of this feature, configuring the bot on the CLI requires that your storage backend be functional and persistent--destroying the storage destroys the configuration. The ability to configure the plugins without a backend is helpful when you want to provide better defaults or when you want to programmatically change config based on environmental factors like running in a container or in a virtual machine, etc.

sijis commented 2 years ago

Closing