Closed mpmoran closed 1 year ago
@mpmoran: The problem is most likely the dotenv().ok();
.
That code turns the Result
(that dotenv
returns) into an Option
(see Result::ok). So you are basically just ignoring any error that dotenv
might return.
The example of the dotenv
function (which is just dotenvy::dotenv().ok();
) is probably not the best example that could be shown.
@d4h0 good comment. I've removed the ok()
examples to make this more clear.
@mpmoran dotenvy
does inform you of parse errors. Using the same .env file as your example:
fn main() {
let e = dotenvy::dotenv().unwrap_err();
print!("{}", e);
}
Error parsing line: '[secrets]', error at line index: 0
I'm going to politician this and say that I can't affirm or deny the previous comments. I'm no longer using this library. Please deal with this issue as it deserves.
This is working when the line is changed to dotenvy::dotenv()
@mpmoran feel free to reopen if you still have issues.
When the library is given a dotenv file that is in INI format (by mistake in my case), it will not create environment variables. I can't find where users are notified of this. Should they be and how?
Here is stuff to reproduce.
.env
main.rs
dependencies
Run with
$ RUST_LOG=debug cargo run | grep DB_