-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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())?; |
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.
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.
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.
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.
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.
In fact it should just be let config: Config = toml.try_into()?;
, but only if toml version is > 0.6.0
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.
Created an issue here: #12 Will cross reference these comments.
The recent change in #7 -- introduced an issue Deserializing Config when the expected values were not present.