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

Improve checks for FlexMeasures' own config settings based on checks for plugin config settings #236

Open
Flix6x opened this issue Nov 10, 2021 · 4 comments

Comments

@Flix6x
Copy link
Contributor

Flix6x commented Nov 10, 2021

From discussion in #230.

Foremost, we want to improve how we encode config settings requirements and replace config_utils.are_required_settings_complete and config_utils.get_config_warnings with functionality we use to check config settings registered by plugins. This means we'll then be able to more expressively define our expected config settings.

Secondly, configs are growing up within FlexMeasures, so we may want to refactor to give configs their own config sub-package.

@Flix6x
Copy link
Contributor Author

Flix6x commented Nov 10, 2021

@nhoening suggested the following files for the config sub-package:

  • __init__.py
  • Readme.md
  • utils.py
  • defaults.py
  • requirements.py

The latter would be where we put the requirements we talk about here. I call it requirements, as I don't think we should list all possible settings there. Or what do you think we should do?

Given that our settings specification now looks like the example below, I'd prefer to keep all config settings together, and not just the required ones. I can also imagine it makes sense to just extend the specification with a "default" key.

settings = [
    "MY_PLUGIN_URL": {
        "description": "URL used by my plugin for x.",
        "level": "error",
    },
    "MY_PLUGIN_TOKEN": {
        "description": "Token used by my plugin for y.",
        "level": "warning",
        "message_if_missing": "Without this token, my plugin will not do y.",
        "parse_as": str,
    },
    "MY_PLUGIN_COLOR": {
        "description": "Color used to override the default plugin color.",
        "level": "info",
    },
]

@nhoening
Copy link
Contributor

I thought about this avenue for a bit, but it changes the way we load settings in a larger way.

There are many settings FlexMeasures relies on, many even defined in other packages.
I'm not sure where the line would be to decide which ones need to be mentioned, if only for a default, while others do not.

@Flix6x
Copy link
Contributor Author

Flix6x commented Nov 10, 2021

What about "just" the ones we mention in https://flexmeasures.readthedocs.io/en/latest/configuration.html?

@nhoening
Copy link
Contributor

Those are all we list in the config_default module I believe. I counted 53.

I counted ten among them which are required (e.g. databases) or recommended (e.g. mail). So that is the lower boundary.

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

No branches or pull requests

2 participants