Skip to content

Commit 76860ed

Browse files
committed
macros-core: give SQLX_OFFLINE_DIR from environment precedence
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.
1 parent 01d5443 commit 76860ed

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • sqlx-macros-core/src/query

sqlx-macros-core/src/query/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ fn init_metadata(manifest_dir: &String) -> crate::Result<Metadata> {
124124
.map(|s| s.eq_ignore_ascii_case("true") || s == "1")
125125
.unwrap_or(false);
126126

127+
let offline_dir = env("SQLX_OFFLINE_DIR").ok().or(offline_dir);
128+
127129
let config = Config::try_from_crate_or_default()?;
128130

129131
let database_url = env(config.common.database_url_var()).ok().or(database_url);

0 commit comments

Comments
 (0)