Skip to content

Conversation

@bh2smith
Copy link
Member

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 GAllen98 and tifrel 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
Member 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
Member 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.

3 participants