Skip to content

Give SQLX_OFFLINE_DIR from environment precedence in macros #3962

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

psionic-k
Copy link

We need to be able to supply this variable via the environment when built via Nix Crane, which uses cargo vendor for dependencies, which will filter the .sqlx path. Renaming is necessary in that case.

Fixes #3961

Tested container build on a branch of 0.8.6 ✔️

@@ -124,6 +124,11 @@ fn init_metadata(manifest_dir: &String) -> crate::Result<Metadata> {
.map(|s| s.eq_ignore_ascii_case("true") || s == "1")
.unwrap_or(false);

let offline_dir = env("SQLX_OFFLINE_DIR")
.ok()
.or(offline_dir.as_ref().cloned())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line doesn't make any sense. It's redundant to .or(offline_dir)

We need to be able to supply this variable via the environment when built via
Nix Crane, which uses cargo vendor, which will filter the .sqlx path.  Renaming
is necessary in that case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLX_OFFLINE_DIR Not being respected during build
2 participants