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

Fix Env Var Override #11

Merged
merged 3 commits into from
Sep 25, 2023
Merged

Fix Env Var Override #11

merged 3 commits into from
Sep 25, 2023

Conversation

bh2smith
Copy link
Collaborator

The recent change in #7 -- introduced an issue Deserializing Config when the expected values were not present.

@bh2smith bh2smith added the bug Something isn't working label Sep 25, 2023
@bh2smith bh2smith requested review from tifrel and GAllen98 September 25, 2023 14:07
@bh2smith bh2smith marked this pull request as ready for review September 25, 2023 14:07
@bh2smith bh2smith changed the title [Bug] Env Var Override Fix Env Var Override Sep 25, 2023
config.set_database(connection.to_string())
}
let toml = manual_override(fs::read_to_string(path)?, node_url, db_url)?;
let config: Config = toml::from_str(&toml.to_string())?;
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't know that this would happen. I tried finding the code to circumvent the serialization + deserialization, but it's not too obvious from the toml crate docs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It isn't, I was not able to find this yet so at least we have something that works smoothly and looks pretty for now.

Copy link
Member

Choose a reason for hiding this comment

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

In fact it should just be let config: Config = toml.try_into()?;, but only if toml version is > 0.6.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created an issue here: #12 Will cross reference these comments.

@bh2smith bh2smith merged commit a3e05dd into main Sep 25, 2023
@bh2smith bh2smith deleted the fix-env-override branch September 25, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants