Disable .env warning for now

This commit is contained in:
Casey Rodarmor 2021-03-30 17:59:15 -07:00 committed by GitHub
parent e4ebf6dad9
commit a1a016b4e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 25 deletions

View File

@ -1,5 +1,7 @@
use crate::common::*;
// Remove this on 2021-07-01.
#[allow(unused)]
pub(crate) fn load_dotenv(
config: &Config,
settings: &Settings,
@ -17,13 +19,15 @@ pub(crate) fn load_dotenv(
let path = directory.join(".env");
if path.is_file() {
if settings.dotenv_load.is_none() && config.verbosity.loud() {
if config.color.stderr().active() {
eprintln!("{:#}", Warning::DotenvLoad);
} else {
eprintln!("{}", Warning::DotenvLoad);
}
}
// Un-comment this on 2021-07-01.
//
// if settings.dotenv_load.is_none() && config.verbosity.loud() {
// if config.color.stderr().active() {
// eprintln!("{:#}", Warning::DotenvLoad);
// } else {
// eprintln!("{}", Warning::DotenvLoad);
// }
// }
let iter = dotenv::from_path_iter(&path)?;
let mut dotenv = BTreeMap::new();

View File

@ -2,6 +2,8 @@ use crate::common::*;
#[derive(Debug, PartialEq)]
pub(crate) enum Warning {
// Remove this on 2021-07-01.
#[allow(dead_code)]
DotenvLoad,
}

View File

@ -66,25 +66,28 @@ test! {
dotenv_load: false,
}
test! {
name: warning,
justfile: r#"
foo:
echo $DOTENV_KEY
"#,
stdout: "dotenv-value\n",
stderr: "
warning: A `.env` file was found and loaded, but this behavior will change in the future.
To silence this warning and continue loading `.env` files, add:
// Un-comment this on 2021-07-01.
//
// test! {
// name: warning,
// justfile: r#"
// foo:
// echo $DOTENV_KEY
// "#,
// stdout: "dotenv-value\n",
// stderr: "
// warning: A `.env` file was found and loaded, but this behavior will
// change in the future. To silence this warning and continue loading `.env`
// files, add:
set dotenv-load := true
// set dotenv-load := true
To silence this warning and stop loading `.env` files, add:
// To silence this warning and stop loading `.env` files, add:
set dotenv-load := false
// set dotenv-load := false
See https://github.com/casey/just/issues/469 for more details.
echo $DOTENV_KEY
",
dotenv_load: false,
}
// See https://github.com/casey/just/issues/469 for more details.
// echo $DOTENV_KEY
// ",
// dotenv_load: false,
// }