-
Notifications
You must be signed in to change notification settings - Fork 22
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
Config customization doesn't work #23
Comments
Oh yes, I didn't encounter this because my personal config was always a copy of the template, thanks for noticing this! |
We would need a second schema, with all optional keys. Being able to have a strict schema, with sane defaults, means the code can assume values exist. Otherwise we'll end up with a mess of I'm not sure how I feel about using optional keys feature of |
We can specify the defaults within the schema for optional keys, so there won't be any issue about |
I feel using optionals is a flawed approach. It complicates the schema, as a workaround. The schema should remain unchanged, as it's technically correct. Optionals makes it unclear to any developer wihtout tribal knowledge. We also don't want to maintain multiple schemas: one for the canonical schema; and the other for the "all-optionals". I think we want to use revalidate, haven't looked at it closely though. What I'm envisioning is:
That way, there should be less custom/duplicate code. It's just plain python assignments, and then reusing the same |
There will still only be one schema in my suggestion, except they are all optionals, which come with default values, which mirrors the idea of our "template config". I think using revalidate will instead use a separate schema since |
The schema with default values would work but the downside (imo quite significant) is that users cannot easily read the default values. Instead of reading a "config.template.yaml", they would need to read a
|
We want the config feature to read a default config and then apply user customizations, similar to Hiera for Puppet. The config template is shipped with code and not intended to be modified, it serves as a template for users to copy and see all possible values. The the user's config is applied on top:
mealpy/mealpy/mealpy.py
Line 55 in a580ab5
The bug is that this uses
load_config_from_file
, which does shema validation, and will fail due to missing values. What we probably want to do instead is naivelyupdate
user's values and then rerun validation (or not, extra values should be ignored).We could also have a minimal schema set for values the user must set. e.g. API tokens. But there's no use case for this yet, just dropping the thought for future reference.
The text was updated successfully, but these errors were encountered: