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

View File

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

View File

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