fix(macro): offline env

This commit is contained in:
Ferenc Tamás 2020-10-13 18:37:36 +02:00 committed by Ryan Leckey
parent 8e4d061dc1
commit a46d7f8fdf

View File

@ -36,7 +36,9 @@ pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
// if `dotenv` wasn't initialized by the above we make sure to do it here
match (
dotenv::var("SQLX_OFFLINE").is_ok(),
dotenv::var("SQLX_OFFLINE")
.map(|s| s.to_lowercase() == "true")
.unwrap_or(false),
dotenv::var("DATABASE_URL"),
) {
(false, Ok(db_url)) => expand_from_db(input, &db_url),