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

Implement defaults for config options #138

Open
AdamWill opened this issue Nov 23, 2023 · 4 comments
Open

Implement defaults for config options #138

AdamWill opened this issue Nov 23, 2023 · 4 comments
Assignees

Comments

@AdamWill
Copy link
Contributor

As reported downstream, at one point our openQA zezere test started failing. We run our own zezere server for the test. What happened is that zezere added a new config option, and the config file we use in the test did not include this option at all. The most common way server software would usually handle this situation is to use some kind of in-built default value, but zezere doesn't do this: if a config option isn't present in the config file, it just fails (ultimately because ConfigParser.getboolean() fails in settings_external.py).

Ideally this mechanism should be tweaked somehow so zezere can set and use defaults for config options that aren't set in the config file at all, then adding a new config option would not require server admins to update their config files unless they need to set it to something non-default.

@nullr0ute
Copy link
Member

@rdotjain could you take a look at this?

@rdotjain
Copy link
Collaborator

As mentioned downstream, we provide default values in default.conf file, but it appears that this file isn't included in the zezere-ignition package. Therefore, we could either add that file to the package or provide a fallback value in the settings itself.

For example, SESSION_COOKIE_SECURE = getboolean("global", "secure_cookie", "SECURE_COOKIE", fallback=True)

@nullr0ute
Copy link
Member

We can add the file to the package easily enough, where does it reside?

@AdamWill
Copy link
Contributor Author

I'd note that just shipping a single monolithic config file also has problems (e.g. if someone edits it, they will never get future updates to it).

I don't know whether you've done this already or not, but if you want to solve it that way, I'd recommend looking into the systemd approach to config files (with snippets, and with the app's defaults shipped in /usr but overrideable from /etc or ~/.config).

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

3 participants