-
Notifications
You must be signed in to change notification settings - Fork 38
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
CLI options must be passed all the time #177
Comments
The obvious solution is to use a configuration file. Some thoughts: At least initially, configuration loading should not be part of the core; most of the things that are configured at the moment are outside of it. If needed, we can add a The same config file should work with the WSGI app (reader._app.wsgi:app), where applicable. There should be a 1:1 mapping between the CLI options and the config file; both pip and uWSGI do this.
We should keep the amount of dependencies to a minimum.
Things that we need to configure at the moment:
|
Here's a prototype of a config file format and how it would be used: link. Update: prototype updates:
Some notes about it:
Some general notes:
|
Some thoughts regarding the TOML thing above: We use Optional types in various places throughout the API in a way where None doesn't necessarily mean "absence of a value" or "use the default", but rather as a special value with a different meaning:
The docs say None is frequently used to represent the absence of a value, as when default arguments are not passed to a function. Our usage abuses this meaning somewhat, and this may pose some issues in the future. So, regarding the current usage: Pros:
Cons:
Not a concern:
|
To implement the prototype:
|
Added an alternate configuration structure and parsing code to the prototype gist: link. Changes/improvements:
|
The test added for the whole config thing in bfb7dfc shows the prototype doesn't actually work like we thought it does. In general, because the way int parameters work (the value always gets passes to int), we can't wrap the defaults in anything. We'll have to find a different way of seeing if an argument is a default or a user value. Maybe override Context.lookup_default()? (but this would only take care of the default_map values...)
Update: I think this describes the same problem: pallets/click#549 (comment) |
Yeah, nevermind, removed the whole thing: ac2c173 |
READER_CONFIG in use: lemon24/owncloud@b6a6ba2 |
...which requires either duplicating them everywhere (so when things change, they need to change in more than one place), or having some alias/wrapper (harder to do for subcommands), or just living with it.
The text was updated successfully, but these errors were encountered: