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

Cleanup defining plugin configuration #97

Merged
merged 9 commits into from
Feb 15, 2019
Merged

Conversation

mlaferrera
Copy link
Contributor

@mlaferrera mlaferrera commented Feb 9, 2019

  • Allow plugin configurations to be in stoq.cfg
  • Merge plugin_opts with plugin config

Plugin configuration order of precedence:

  1. plugin options provided at instantiation of Stoq(plugin_opts=...)

  2. plugin configuration in stoq.cfg

  3. plugin_name.stoq

    Plugin configuration may be added as a new section in stoq.cfg. For example, to add worker_rules to the yarascan plugin in stoq.cfg:

[yarascan]
worker_rules = /new/path/rules.yar

When handling configuration options within a plugin (again, using yarascan as an example) it would change from:

if plugin_opts and "worker_rules" in plugin_opts:
        worker_ruleset = plugin_opts["worker_rules"]
elif config.has_option("options", "worker_rules"):
        worker_ruleset = config.get("options", "worker_rules")
else:
        worker_ruleset = None

to:

worker_ruleset = config.get("options", "worker_rules", fallback=None)

- Allow plugin configurations to be in stoq.cfg
- Merge plugin_opts with plugin config
@mlaferrera mlaferrera self-assigned this Feb 9, 2019
@coveralls
Copy link

coveralls commented Feb 9, 2019

Coverage Status

Coverage decreased (-0.03%) to 95.095% when pulling 9544fd8 on plugin_opts_config into 1f9c013 on master.

@mlaferrera mlaferrera merged commit b0c05b7 into master Feb 15, 2019
@mlaferrera mlaferrera deleted the plugin_opts_config branch February 15, 2019 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants