Skip to content

Commit fb6b13e

Browse files
authored
macros-core: give SQLX_OFFLINE_DIR from environment precedence (#3962)
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 c825bd3 commit fb6b13e

File tree

1 file changed

+2
-0
lines changed
  • sqlx-macros-core/src/query

1 file changed

+2
-0
lines changed

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)