diff --git a/Cargo.lock b/Cargo.lock index d7cdf2624d..9e048f0c1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1986,8 +1986,6 @@ dependencies = [ [[package]] name = "easyenv" version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f3d306adc28605287f6ded00f416af86373c9c576ce174b6bd2afd46d575a7" dependencies = [ "dotenv", "env_logger 0.10.0", diff --git a/Cargo.toml b/Cargo.toml index 3c91b498d9..5bb79076f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ members = [ "crates/lib/deprecated/config", # TODO(bt, 2023-02-13): Deprecate or repurpose "crates/lib/deprecated/container_common", # TODO(bt, 2023-02-13): Pull apart and rehome pieces "crates/lib/deprecated/http_server_common", # TODO(bt, 2023-03-20): Move useful pieces to actix_helpers + "crates/lib/easyenv", # NB: Vendored version of https://github.com/echelon/easyenv.rs that we'll improve. "crates/lib/envvar", "crates/lib/errors", "crates/lib/files/archives", diff --git a/crates/cli/database_backup/Cargo.toml b/crates/cli/database_backup/Cargo.toml index ed394a9d11..838169307f 100644 --- a/crates/cli/database_backup/Cargo.toml +++ b/crates/cli/database_backup/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal config = { path = "../../lib/deprecated/config" } container_common = { path = "../../lib/deprecated/container_common" } +easyenv = { path = "../../lib/easyenv" } # External anyhow = "1.0.40" @@ -25,7 +26,6 @@ clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updat # TODO/NB: Commenting out clap4 as it prevents windows builds # NB: clap4 = { package = "clap", version = "4.0" } dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" log = "0.4.14" diff --git a/crates/cli/database_cleanup/Cargo.toml b/crates/cli/database_cleanup/Cargo.toml index 0abaafbf17..94e5ae4e56 100644 --- a/crates/cli/database_cleanup/Cargo.toml +++ b/crates/cli/database_cleanup/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal config = { path = "../../lib/deprecated/config" } container_common = { path = "../../lib/deprecated/container_common" } +easyenv = { path = "../../lib/easyenv" } # External anyhow = "1.0.40" @@ -24,7 +25,6 @@ chrono = { version = "0.4.19", features = ["serde"] } # TODO/NB: Commenting out clap4 as it prevents windows builds # clap4 = { package = "clap", version = "4.0" } # TODO/NB: We're using an older version of clap elsewhere, hence the naming. dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" log = "0.4.14" diff --git a/crates/lib/api_clients/twitch_common/Cargo.toml b/crates/lib/api_clients/twitch_common/Cargo.toml index 9e7152f00d..340e46ae80 100644 --- a/crates/lib/api_clients/twitch_common/Cargo.toml +++ b/crates/lib/api_clients/twitch_common/Cargo.toml @@ -16,12 +16,12 @@ path = "src/lib.rs" # Internal container_common = { path = "../../deprecated/container_common" } +easyenv = { path = "../../easyenv" } # External anyhow = "1.0.40" once_cell = "1.9.0" regex = "1.5.4" -easyenv = "0.0.9" # Twitch # NB "unsupported" pubsub features may disappear from the Twitch API at any time. It's an unofficial API. diff --git a/crates/lib/bootstrap/Cargo.toml b/crates/lib/bootstrap/Cargo.toml index f82968ca11..894ea268f4 100644 --- a/crates/lib/bootstrap/Cargo.toml +++ b/crates/lib/bootstrap/Cargo.toml @@ -15,13 +15,13 @@ path = "src/lib.rs" [dependencies] # Internal +easyenv = { path = "../easyenv" } envvar = { path = "../envvar" } errors = { path = "../errors" } server_environment = { path = "../server_environment" } # External dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" log = "0.4.14" diff --git a/crates/lib/deprecated/config/Cargo.toml b/crates/lib/deprecated/config/Cargo.toml index b63dcb03db..2497781de7 100644 --- a/crates/lib/deprecated/config/Cargo.toml +++ b/crates/lib/deprecated/config/Cargo.toml @@ -15,6 +15,9 @@ path = "src/lib.rs" # TODO: Remove these dependencies. # These were introduced in refactoring. Config should have few, if any, dependencies. [dependencies] +# Internal +easyenv = { path = "../../../lib/easyenv" } + +# External anyhow = "1.0.40" -easyenv = "0.0.9" url = "2.2.2" diff --git a/crates/lib/easyenv/Cargo.toml b/crates/lib/easyenv/Cargo.toml new file mode 100644 index 0000000000..aa82f6e096 --- /dev/null +++ b/crates/lib/easyenv/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "easyenv" +edition = "2018" +version = "0.0.9" +authors = [ + "Brandon Thomas ", + "Brandon Thomas ", +] +publish = false + +[lib] +name = "easyenv" +path = "src/lib.rs" + +[dependencies] +dotenv = "0.15.0" +env_logger = "0.10.0" +log = "0.4.14" + +[dev-dependencies] +# None yet diff --git a/crates/lib/easyenv/src/boolean.rs b/crates/lib/easyenv/src/boolean.rs new file mode 100644 index 0000000000..445103883b --- /dev/null +++ b/crates/lib/easyenv/src/boolean.rs @@ -0,0 +1,75 @@ +use std::env; +use std::env::VarError; +use log::warn; +use crate::EnvError; + +/// Get an environment variable as a bool. +/// If not present or there is an error in parsing, return `None`. +pub fn get_env_bool_optional(env_name: &str) -> Option { + match env::var(env_name).as_ref().ok() { + None => { + warn!("Env var '{}' not supplied.", env_name); + None + }, + Some(val) => match val.as_ref() { + "TRUE" => Some(true), + "true" => Some(true), + "FALSE" => Some(false), + "false" => Some(false), + _ => { + warn!("Env var '{}': error parsing boolean value: {:?}", env_name, val); + None + }, + } + } +} + +/// Get an environment variable as a bool, or fall back to the provided default. +/// Returns the default in the event of a parse error. +pub fn get_env_bool_or_default(env_name: &str, default: bool) -> bool { + get_env_bool_internal(env_name) + .map(|maybe| match maybe { + None => { + warn!("Env var '{}' not supplied. Using default '{}'.", env_name, default); + default + }, + Some(val) => val, + }) + .unwrap_or_else(|e| { + warn!("Env var '{}': error parsing boolean value: {:?}. Using default '{}'.", + env_name, e, default); + default + }) +} + +/// Get an environment variable as a bool. +/// If not provided or cannot parse, return an error. +pub fn get_env_bool_required(env_name: &str) -> Result { + get_env_bool_internal(env_name) + .and_then(|maybe| match maybe { + None => { + warn!("Env var '{}' not supplied.", env_name); + Err(EnvError::RequiredNotPresent) + }, + Some(val) => Ok(val), + }) +} + +fn get_env_bool_internal(env_name: &str) -> Result, EnvError> { + match env::var(env_name).as_deref() { + Err(err) => match err { + // TODO: EnvError enum variant for equals sign in env var name + VarError::NotPresent => Ok(None), + VarError::NotUnicode(_) => Err(EnvError::NotUnicode), + } + Ok(val) => match val { + "TRUE" => Ok(Some(true)), + "true" => Ok(Some(true)), + "FALSE" => Ok(Some(false)), + "false" => Ok(Some(false)), + _ => { + Err(EnvError::ParseError { reason: format!("Couldn't parse as bool: '{}'", val) }) + }, + } + } +} diff --git a/crates/lib/easyenv/src/duration.rs b/crates/lib/easyenv/src/duration.rs new file mode 100644 index 0000000000..b8031a6194 --- /dev/null +++ b/crates/lib/easyenv/src/duration.rs @@ -0,0 +1,63 @@ +use crate::EnvError; +use log::warn; +use std::env; +use std::time::Duration; + +/// Get an environment variable as a `Duration` in seconds. +/// If not provided or cannot parse, return an error. +pub fn get_env_duration_seconds_required(env_name: &str) -> Result { + get_env_duration_seconds_internal(env_name) + .and_then(|maybe| match maybe { + None => { + warn!("Env var '{}' not supplied.", env_name); + Err(EnvError::RequiredNotPresent) + }, + Some(val) => Ok(val), + }) +} + +/// Get an environment variable as a `Duration` in seconds. +/// If not present or there is an error in parsing, return `None`. +pub fn get_env_duration_seconds_optional(env_name: &str) -> Option { + match get_env_duration_seconds_internal(env_name) { + Err(e) => { + warn!("Env var '{}': error parsing numeric value: `{:?}`. Returning no value.", env_name, e); + None + }, + Ok(None) => { + warn!("Env var '{}' not present.", env_name); + None + }, + Ok(Some(value)) => Some(value), + } +} + +/// Get an environment variable as a `Duration` in seconds, or fall back to the provided default. +/// Returns the default in the event of a parse error. +pub fn get_env_duration_seconds_or_default(env_name: &str, default: Duration) -> Duration { + get_env_duration_seconds_internal(env_name) + .map(|maybe| match maybe { + None => { + warn!("Env var '{}' not supplied. Using default '{:?}'.", env_name, default); + default + }, + Some(val) => val, + }) + .unwrap_or_else(|e| { + warn!("Env var '{}': error parsing numeric value: {:?}. Using default '{:?}'.", + env_name, e, default); + default + }) +} + +fn get_env_duration_seconds_internal(env_name: &str) -> Result, EnvError> { + match env::var(env_name).as_ref().ok() { + None => { + Ok(None) + }, + Some(val) => match val.parse::() { + Ok(number) => Ok(Some(Duration::from_secs(number))), + Err(_) => Err(EnvError::ParseError { reason: format!("Couldn't parse as number: '{}'", val) }) + } + } +} diff --git a/crates/lib/easyenv/src/lib.rs b/crates/lib/easyenv/src/lib.rs new file mode 100644 index 0000000000..78e763d967 --- /dev/null +++ b/crates/lib/easyenv/src/lib.rs @@ -0,0 +1,111 @@ +// Copyright (c) 2020 Brandon Thomas + +//! Very simple helper functions for environment variables and environment variable-driven +//! `env_logger` configuration. + +#![deny(dead_code)] +#![deny(missing_docs)] +#![deny(unreachable_patterns)] +#![deny(unused_extern_crates)] +#![deny(unused_imports)] +#![deny(unused_qualifications)] +#![deny(unused_qualifications)] + +use env_logger; +use std::error::Error; +use std::fmt::{Display, Debug, Formatter}; +use std::{env, fmt}; + +mod boolean; +mod duration; +mod pathbuf; +mod string; +mod num; + +/// Name of the environment variable Rust's env logger uses +pub const ENV_RUST_LOG : &'static str = "RUST_LOG"; + +const DEFAULT_LOG_LEVEL: &'static str = "info"; + +/// Errors with env variables. +#[derive(Debug)] +pub enum EnvError { + /// The environment variable value is not unicode. + NotUnicode, + /// Problem parsing the env variable as the desired type. + ParseError { + /// Explanation of the parsing failure. + reason: String + }, + /// The required environment variable wasn't present. + RequiredNotPresent, +} + +impl Display for EnvError { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "EnvError::ParseError") + } +} + +impl Error for EnvError { + fn source(&self) -> Option<&(dyn Error + 'static)> { + None + } +} + +pub use boolean::get_env_bool_optional; +pub use boolean::get_env_bool_or_default; +pub use boolean::get_env_bool_required; + +pub use duration::get_env_duration_seconds_optional; +pub use duration::get_env_duration_seconds_or_default; +pub use duration::get_env_duration_seconds_required; + +pub use num::get_env_num; + +pub use pathbuf::get_env_pathbuf_optional; +pub use pathbuf::get_env_pathbuf_or_default; +pub use pathbuf::get_env_pathbuf_required; + +pub use string::get_env_string_optional; +pub use string::get_env_string_or_default; +pub use string::get_env_string_required; + +/// Initialize Rust's env logger. +/// +/// The Rust logger reads the desired log level from the `RUST_LOG` environment variable. If this +/// isn't set, the provided default is used. If a default fallback isn't provided to this function, +/// we fall back to `"info"`. +/// +/// A more robust logging config might configure on a per-component basis, eg. +/// `"tokio_reactor=warn,hyper=info,debug"`. You can read more in the `log` and `env_logger` crate +/// docs. +pub fn init_env_logger(default_if_absent: Option<&str>) { + if env::var(ENV_RUST_LOG) + .as_ref() + .ok() + .is_none() + { + let default_log_level = default_if_absent.unwrap_or(DEFAULT_LOG_LEVEL); + println!("Setting default logging level to \"{}\", override with env var {}.", + default_log_level, ENV_RUST_LOG); + env::set_var(ENV_RUST_LOG, default_log_level); + } + + env_logger::init(); +} + +/// Initialize dotenv with the default `.env` config file. +pub fn init_dotenv() { + match dotenv::dotenv() { + Ok(_) => println!("dotenv configs initialized"), + Err(e) => println!("Could not initialize dotenv: {:?}", e), + } +} + +/// Initialize dotenv and env logger. +/// See `init_dotenv()` and `init_env_logger(Option<&str>)` for further details. +pub fn init_all_with_default_logging(default_if_absent: Option<&str>) { + init_dotenv(); + init_env_logger(default_if_absent) +} diff --git a/crates/lib/easyenv/src/num.rs b/crates/lib/easyenv/src/num.rs new file mode 100644 index 0000000000..1e164fa024 --- /dev/null +++ b/crates/lib/easyenv/src/num.rs @@ -0,0 +1,26 @@ +use std::env; +use std::fmt::{Debug, Display}; +use std::str::FromStr; +use log::{error, warn}; +use crate::EnvError; + +/// Get an environment variable as a number, or fall back to the provided default if not set. +/// If the env var is present but can't be parsed, an error is returned instead. +pub fn get_env_num(env_name: &str, default: T) -> Result + where T: FromStr + Display, + T::Err: Debug +{ + match env::var(env_name).as_ref().ok() { + None => { + warn!("Env var '{}' not supplied. Using default '{}'.", env_name, default); + Ok(default) + }, + Some(val) => { + val.parse::() + .map_err(|e| { + error!("Can't parse value '{:?}'. Error: {:?}", val, e); + EnvError::ParseError { reason: format!("Can't parse value: {:?}", e) } + }) + }, + } +} diff --git a/crates/lib/easyenv/src/pathbuf.rs b/crates/lib/easyenv/src/pathbuf.rs new file mode 100644 index 0000000000..fe6ce6f6db --- /dev/null +++ b/crates/lib/easyenv/src/pathbuf.rs @@ -0,0 +1,73 @@ +use crate::EnvError; +use log::warn; +use std::env::VarError; +use std::env; +use std::path::{Path, PathBuf}; +use std::str::FromStr; + +/// Get an environment variable as a `PathBuf`. +/// If not provided or cannot parse, return an error. +pub fn get_env_pathbuf_required(env_name: &str) -> Result { + get_env_pathbuf_internal(env_name) + .and_then(|maybe| match maybe { + None => { + warn!("Env var '{}' not supplied.", env_name); + Err(EnvError::RequiredNotPresent) + }, + Some(val) => Ok(val), + }) +} + +/// Get an environment variable as a `PathBuf`. +/// If not present or there is an error in parsing, return `None`. +pub fn get_env_pathbuf_optional(env_name: &str) -> Option { + match get_env_pathbuf_internal(env_name) { + Err(e) => { + warn!("Env var '{}': error parsing PathBuf value: `{:?}`. Returning no value.", env_name, e); + None + }, + Ok(None) => { + warn!("Env var '{}' not present.", env_name); + None + }, + Ok(Some(value)) => Some(value), + } +} + +/// Get an environment variable as a `PathBuf`, or fall back to the provided default. +/// Returns the default in the event of a parse error. +pub fn get_env_pathbuf_or_default>(env_name: &str, default_value: P) -> PathBuf { + get_env_pathbuf_internal(env_name) + .map(|maybe| match maybe { + None => { + let default_path = default_value.as_ref().to_path_buf(); + warn!("Env var '{}' not supplied. Using default '{:?}'.", env_name, &default_path); + default_path + }, + Some(val) => val, + }) + .unwrap_or_else(|e| { + let default_path = default_value.as_ref().to_path_buf(); + warn!("Env var '{}': error: {:?}. Using default '{:?}'.", + env_name, e, &default_path); + default_path + }) +} + +fn get_env_pathbuf_internal(env_name: &str) -> Result, EnvError> { + match env::var(env_name).as_ref() { + Err(err) => match err { + // TODO: EnvError enum variant for equals sign in env var name + VarError::NotPresent => Ok(None), + VarError::NotUnicode(_) => Err(EnvError::NotUnicode), + } + Ok(val) => { + match PathBuf::from_str(val) { + Ok(path) => Ok(Some(path)), + Err(_err) => Err(EnvError::ParseError { + reason: "error parsing PathBuf from value".to_string() + }), + } + } + } +} diff --git a/crates/lib/easyenv/src/string.rs b/crates/lib/easyenv/src/string.rs new file mode 100644 index 0000000000..fe43cca95b --- /dev/null +++ b/crates/lib/easyenv/src/string.rs @@ -0,0 +1,37 @@ +use crate::EnvError; +use log::warn; +use std::env; + +/// Get an environment variable as an optional `String`. +pub fn get_env_string_optional(env_name: &str) -> Option { + match env::var(env_name).as_ref().ok() { + Some(s) => Some(s.to_string()), + None => { + warn!("Env var '{}' not supplied.", env_name); + None + }, + } +} + +/// Get an environment variable as a `String`, or fall back to the provided default. +pub fn get_env_string_or_default(env_name: &str, default: &str) -> String { + match env::var(env_name).as_ref().ok() { + Some(s) => s.to_string(), + None => { + warn!("Env var '{}' not supplied. Using default '{}'.", env_name, default); + default.to_string() + }, + } +} + +/// Get an environment variable as a `String`, or return an error. +pub fn get_env_string_required(env_name: &str) -> Result { + match env::var(env_name).as_ref().ok() { + Some(s) => Ok(s.to_string()), + None => { + warn!("Required env var '{}' not supplied.", env_name); + Err(EnvError::RequiredNotPresent) + }, + } +} + diff --git a/crates/lib/envvar/Cargo.toml b/crates/lib/envvar/Cargo.toml index b559ae6268..bd9c7b650e 100644 --- a/crates/lib/envvar/Cargo.toml +++ b/crates/lib/envvar/Cargo.toml @@ -16,11 +16,11 @@ path = "src/lib.rs" [dependencies] # Internal +easyenv = { path = "../easyenv" } errors = { path = "../errors" } # External dotenv = "0.15.0" -easyenv = "0.0.9" log = "0.4.14" [dev-dependencies] diff --git a/crates/lib/server_environment/Cargo.toml b/crates/lib/server_environment/Cargo.toml index 1bb1501ab2..61cd26d1e1 100644 --- a/crates/lib/server_environment/Cargo.toml +++ b/crates/lib/server_environment/Cargo.toml @@ -15,12 +15,12 @@ path = "src/lib.rs" [dependencies] # Internal +easyenv = { path = "../easyenv" } envvar = { path = "../envvar" } errors = { path = "../errors" } # External dotenv = "0.15.0" -easyenv = "0.0.9" log = "0.4.14" [dev-dependencies] diff --git a/crates/programs/aichatbot-sidecar/Cargo.toml b/crates/programs/aichatbot-sidecar/Cargo.toml index 8c7f2bce9e..6aeca13714 100644 --- a/crates/programs/aichatbot-sidecar/Cargo.toml +++ b/crates/programs/aichatbot-sidecar/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal actix_helpers = { path = "../../lib/actix_helpers" } concurrency = { path = "../../lib/concurrency" } +easyenv = { path = "../../lib/easyenv" } enums = { path = "../../_types/enums" } errors = { path = "../../lib/errors" } fakeyou_client = { path = "../../lib/api_clients/fakeyou_client" } @@ -34,7 +35,6 @@ base64 = "0.21.0" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" log = "0.4.14" once_cell = "1.9.0" path-absolutize = "3.0.14" # Absolute paths have not stabilized in Rust yet diff --git a/crates/service/job/analytics_job/Cargo.toml b/crates/service/job/analytics_job/Cargo.toml index 60eaf22312..ef52f762a6 100644 --- a/crates/service/job/analytics_job/Cargo.toml +++ b/crates/service/job/analytics_job/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } enums = { path = "../../../_types/enums" } errors = { path = "../../../lib/errors" } jobs_common = { path = "../../../lib/jobs_common" } @@ -29,7 +30,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" log = "0.4.14" rand = "0.8.3" diff --git a/crates/service/job/download_job/Cargo.toml b/crates/service/job/download_job/Cargo.toml index ded8de06fd..18060d8522 100644 --- a/crates/service/job/download_job/Cargo.toml +++ b/crates/service/job/download_job/Cargo.toml @@ -21,6 +21,7 @@ concurrency = { path = "../../../lib/concurrency" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } crockford = { path = "../../../lib/crockford" } +easyenv = { path = "../../../lib/easyenv" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } @@ -42,7 +43,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/job/inference_job/Cargo.toml b/crates/service/job/inference_job/Cargo.toml index a9787a1bb1..004cb29847 100644 --- a/crates/service/job/inference_job/Cargo.toml +++ b/crates/service/job/inference_job/Cargo.toml @@ -22,6 +22,7 @@ cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } concurrency = { path = "../../../lib/concurrency" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } @@ -45,7 +46,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/job/tts_download_job/Cargo.toml b/crates/service/job/tts_download_job/Cargo.toml index 8795acd7b9..299c5fff7d 100644 --- a/crates/service/job/tts_download_job/Cargo.toml +++ b/crates/service/job/tts_download_job/Cargo.toml @@ -18,6 +18,7 @@ path = "src/main.rs" cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } enums = { path = "../../../_types/enums" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } hashing = { path = "../../../lib/files/hashing" } @@ -33,7 +34,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/job/tts_inference_job/Cargo.toml b/crates/service/job/tts_inference_job/Cargo.toml index 8f4835ee6a..4e6c0c5e49 100644 --- a/crates/service/job/tts_inference_job/Cargo.toml +++ b/crates/service/job/tts_inference_job/Cargo.toml @@ -18,6 +18,7 @@ path = "src/main.rs" cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } memory_caching = { path = "../../../lib/caching/memory_caching" } @@ -32,7 +33,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/job/w2l_download_job/Cargo.toml b/crates/service/job/w2l_download_job/Cargo.toml index 3388ab0ff7..36f4b5b9ee 100644 --- a/crates/service/job/w2l_download_job/Cargo.toml +++ b/crates/service/job/w2l_download_job/Cargo.toml @@ -19,6 +19,7 @@ buckets = { path = "../../../_types/buckets" } cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } @@ -33,7 +34,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/job/w2l_inference_job/Cargo.toml b/crates/service/job/w2l_inference_job/Cargo.toml index c5c0bc5518..dc97060141 100644 --- a/crates/service/job/w2l_inference_job/Cargo.toml +++ b/crates/service/job/w2l_inference_job/Cargo.toml @@ -18,6 +18,7 @@ path = "src/main.rs" cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } jobs_common = { path = "../../../lib/jobs_common" } mysql_queries = { path = "../../../lib/mysql_queries" } @@ -31,7 +32,6 @@ anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" lfu = "0.2.5" log = "0.4.14" diff --git a/crates/service/other/twitch_pubsub_subscriber/Cargo.toml b/crates/service/other/twitch_pubsub_subscriber/Cargo.toml index 496947588b..7169f7bfe6 100644 --- a/crates/service/other/twitch_pubsub_subscriber/Cargo.toml +++ b/crates/service/other/twitch_pubsub_subscriber/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } http_server_common = { path = "../../../lib/deprecated/http_server_common" } mysql_queries = { path = "../../../lib/mysql_queries" } redis_common = { path = "../../../lib/redis_common" } @@ -29,7 +30,6 @@ base64 = "0.13.0" chrono = { version = "0.4.19", features = ["serde"] } derive_more = "0.99.14" dotenv = "0.15.0" -easyenv = "0.0.9" futures-timer = "3.0.2" hex = "0.4.3" hostname = "0.3.1" diff --git a/crates/service/web/dummy_service/Cargo.toml b/crates/service/web/dummy_service/Cargo.toml index 308343ef3f..ac1c5dd3b2 100644 --- a/crates/service/web/dummy_service/Cargo.toml +++ b/crates/service/web/dummy_service/Cargo.toml @@ -16,6 +16,7 @@ path = "src/main.rs" # Internal actix_helpers = { path = "../../../lib/actix_helpers" } +easyenv = { path = "../../../lib/easyenv" } errors = { path = "../../../lib/errors" } http_server_common = { path = "../../../lib/deprecated/http_server_common" } reusable_types = { path = "../../../_types/reusable_types" } @@ -23,7 +24,6 @@ reusable_types = { path = "../../../_types/reusable_types" } # External chrono = { version = "0.4.19", features = ["serde"] } dotenv = "0.15.0" -easyenv = "0.0.9" hostname = "0.3.1" #once_cell = "1.9.0" #regex = "1.5.4" diff --git a/crates/service/web/storyteller_web/Cargo.toml b/crates/service/web/storyteller_web/Cargo.toml index 549956f1ad..c90c454476 100644 --- a/crates/service/web/storyteller_web/Cargo.toml +++ b/crates/service/web/storyteller_web/Cargo.toml @@ -23,6 +23,7 @@ cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } datetimes = { path = "../../../lib/datetimes" } +easyenv = { path = "../../../lib/easyenv" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } @@ -56,7 +57,6 @@ base64 = "0.13.0" chrono = { version = "0.4.19", features = ["serde"] } derive_more = "0.99.14" dotenv = "0.15.0" -easyenv = "0.0.9" hex = "0.4.3" hostname = "0.3.1" lazy_static = "1.4.0" diff --git a/crates/service/web/websocket_gateway/Cargo.toml b/crates/service/web/websocket_gateway/Cargo.toml index 507ae26cbf..5b811a82cf 100644 --- a/crates/service/web/websocket_gateway/Cargo.toml +++ b/crates/service/web/websocket_gateway/Cargo.toml @@ -17,6 +17,7 @@ path = "src/main.rs" # Internal config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } +easyenv = { path = "../../../lib/easyenv" } errors = { path = "../../../lib/errors" } http_server_common = { path = "../../../lib/deprecated/http_server_common" } mysql_queries = { path = "../../../lib/mysql_queries" } @@ -29,7 +30,6 @@ base64 = "0.13.0" chrono = { version = "0.4.19", features = ["serde"] } derive_more = "0.99.14" dotenv = "0.15.0" -easyenv = "0.0.9" futures-timer = "3.0.2" hex = "0.4.3" hostname = "0.3.1" diff --git a/execute_tests.sh b/execute_tests.sh index 449511c0f3..319503eb31 100755 --- a/execute_tests.sh +++ b/execute_tests.sh @@ -19,6 +19,7 @@ cargo test \ cargo test \ --package inference-job \ -- \ - --skip util::audiowmark::tests::test_audiowmark + --skip util::audiowmark::tests::test_audiowmark \ + --skip util::common_commands::audiowmark::tests::test_audiowmark echo 'Tests passed.'