-
Notifications
You must be signed in to change notification settings - Fork 512
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
Allow setting defaults through a config file. #279
base: master
Are you sure you want to change the base?
Conversation
Current coverage is
|
Hey @sunu, Thanks for the PR! There are some design decisions to make:
|
Yes, this makes a lot of sense. I just went for yaml because I find it somewhat more readable. Using ini files makes sense if we're already using them.
Good to know. Thanks. Will remember to use safe_load with yaml from now on.
How is this implemented? Should we hard-code the possible standard locations?
OK. Will add an option for that. |
What I wanted to ask earlier is that in this implementation we essentially read the config file every time settings is imported. So doesn't that count as blocking code? Or does it not matter because of the relatively small size? |
Hey @sunu!
Yes.
For config files it makes more sense to read them once and then return results from memory. Blocking doesn't matter because it is very quick to read a config file, and because it is usually read at startup when Splash is not serving requests yet. True non-blocking reads from disk are rarely used because usually you can't make reads from disk more efficient by sending several read requests in parallel. |
Also * Look for config files in some standard locations. * Add option to specify config file location at startup.
…onfigfile Conflicts: splash/render_options.py splash/server.py
Hello @kmike Also, should the config keys be case insensitive? I've overridden the default behavior to make them case sensitive, but let me know what the expected behavior is. |
Hey @sunu, I think using |
Hey @kmike, |
class ConfigError(Exception): | ||
pass | ||
|
||
global CONFIG_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.
this looks brittle.. It will require changing more code, but maybe we can make this path a Settings constructor parameter and don't create a global settings
variable at module level? We can create it in server startup code (when the path is known) and pass it down to all components via function/method/constructor arguments instead.
Partly addresses #146