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

When project is in cargo's workspace, infer_schema! fails for "Failed to load environment variable POSTGRES_URL: environment variable not found" #823

Closed
redtankd opened this Issue Mar 23, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@redtankd

redtankd commented Mar 23, 2017

My cargo workspace's structure is below:

workspace/
     |----Cargo.toml
     |----mydieselproject/
                |----Cargo.toml

When I build or test in the dir workspace with option "--all", building is failed. The message is

 --> diesel/src/schema.rs:2:1
  |
2 | infer_schema!("dotenv:POSTGRES_URL");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: called `Result::unwrap()` on an `Err` value: "Failed to load environment variable POSTGRES_URL: environment variable not found"
  = note: this error originates in a macro outside of the current crate

I think it is because the .env is not in dir workspace.

@lancecarlson

This comment has been minimized.

Contributor

lancecarlson commented Aug 15, 2017

Did you figure out this issue? The error is saying it can't find your env variable, likely because you are missing your .env file as you suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment