-
Notifications
You must be signed in to change notification settings - Fork 77
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
Use TOML for the configuration file #59
Conversation
@untitaker I'd love some feedback on whether this is worthwhile. Not sure it's of any actual use, though it makes sense for have todoman and vdirsyncer use the same format. |
I am really not sure whether adding a new dependency is worth it if you currently have two config keys, both of which are strings. Switch to TOML won't happen that soon for vdirsyncer. The intermediate goal in vdirsyncer's case is to get everybody to switch to quoted strings in their config. |
return config | ||
with open(path) as conffile: | ||
config = toml.loads(conffile.read()) | ||
# TODO: Validate required fields here (ie: path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're adding dependencies already you might as well use JSON-Schema for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, yeah, I'll look at validating the config file, since that would be a stronger bonus. But I don't see how to do this without another dependency (python-jsonschema).
6049136
to
f78f025
Compare
Added schema validation, and some tests. I believe we can also clean up a few other bits of code, since we can always assume that all configuration variables exist, and are valid. |
Implementation looks good to me. This adds 0.1s overhead on my machine though. |
Oh, I see that you're using |
I'll take a look at it. The interface seems pretty much the same. |
Yeah the interface is always json-ish. But |
I've opted for configobj (#31) rather than toml.
|
Use TOML as a config format:
Set default values when we load the config, rather than scatter them around the app, which should make everything a bit cleaner.
Closes #31