Skip to content

Commit c37f4fa

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 c37f4fa

File tree

1 file changed

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

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ 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")
128+
.ok()
129+
.or(offline_dir.as_ref().cloned())
130+
.or(offline_dir);
131+
127132
let config = Config::try_from_crate_or_default()?;
128133

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

0 commit comments

Comments
 (0)