Open jplatte opened 4 years ago
@weiznich I don't know what the intended behaviour is. Is it usually fatal if dotenv()
setup fails or should a failure be ignored?
First of all: I'm also not sure what's the intended behavior there, for error cases, as I've not written that code. Beside of that the documentation of dotenv
uses literally the same code so I would say it's fine.
As far as I understand those snippet it just looks for a file called .env
and loads it's content as environment variables. As it is doing io there are many reasons this call can fail, so it returns an error. For applications that normally non-fatal as if this load fails a few environment variables are not set.
I guess I need to start with a PR on dotenv then.. Will do that soon.
The first Rust code example, also available under examples/postgres/getting_started_step_1, is using
.ok();
to discard the error case of aResult
. If ignoring any errors is intentional, that line should be updated fromto
Otherwise, the
.ok()
should be replaced by something else (maybe.expect("dotenv setup to be successful")
).Checklist