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

Load config file less at startup #419

Merged
merged 4 commits into from
Jul 1, 2022
Merged

Conversation

avery-blanchard
Copy link
Contributor

This fixes #390 and reduces the number of times the configuration file is loaded during startup. To achieve this, the opened Ini object is passed around rather than being opened with each call to config_get or config_get_env.
@lkatalin

@lkatalin
Copy link
Contributor

Sorry I forgot to mention the DCO @avery-blanchard ! You can update your commit(s) to have your sign off with git commit --amend -s (this will change the latest commit to have it).

@lkatalin
Copy link
Contributor

/packit retest-failed

src/common.rs Outdated
@@ -555,18 +637,32 @@ fn config_file_get() -> String {
}

/// Returns revocation ip from keylime.conf if env var not present
fn revocation_ip_get() -> Result<String> {
config_get_env("general", "receive_revocation_ip", "REVOCATION_IP")
fn revocation_ip_get(conf_name: &str, conf: &Ini) -> Result<String> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These couple of functions (revocation_ip_get and revocation_port_get) are not used anywhere. We could use them in KeylimeConfig::build or perhaps just remove the functions.

@lkatalin
Copy link
Contributor

lkatalin commented Jul 1, 2022

Thanks @avery-blanchard ! Pretty much LGTM.

One nit: In your last commit (removing the two extra functions), you're also including some changes to make &String into &str. Just for clarity I would either amend your commit message to describe that as well, or alternatively edit your earlier commit to already include this change so that it doesn't show up in the later commit.

…ange String to &str.

Signed-off-by: Avery Blanchard <[email protected]>
@lkatalin lkatalin merged commit 9c27905 into keylime:master Jul 1, 2022
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

Successfully merging this pull request may close these issues.

Config file is loaded many times at startup
5 participants