feat: v0.6.0
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
use std::env;
|
||||
|
||||
use rust_util::{debugging, warning};
|
||||
use rust_util::{debugging, iff, warning};
|
||||
use rust_util::util_env as rust_util_env;
|
||||
|
||||
use crate::consts;
|
||||
|
||||
pub const TINY_ENCRYPT_ENV_DEFAULT_ALGORITHM: &str = "TINY_ENCRYPT_DEFAULT_ALGORITHM";
|
||||
pub const TINY_ENCRYPT_ENV_DEFAULT_COMPRESS: &str = "TINY_ENCRYPT_DEFAULT_COMPRESS";
|
||||
|
||||
pub fn get_default_encryption_algorithm() -> Option<&'static str> {
|
||||
let env_default_algorithm = env::var(consts::TINY_ENCRYPT_ENV_DEFAULT_ALGORITHM).ok();
|
||||
debugging!("Environment variable {} = {:?}", consts::TINY_ENCRYPT_ENV_DEFAULT_ALGORITHM, env_default_algorithm);
|
||||
let env_default_algorithm = env::var(TINY_ENCRYPT_ENV_DEFAULT_ALGORITHM).ok();
|
||||
debugging!("Environment variable {} = {:?}", TINY_ENCRYPT_ENV_DEFAULT_ALGORITHM, env_default_algorithm);
|
||||
if let Some(env_algorithm) = env_default_algorithm {
|
||||
let lower_default_algorithm = env_algorithm.to_lowercase();
|
||||
match lower_default_algorithm.as_str() {
|
||||
@@ -16,4 +20,8 @@ pub fn get_default_encryption_algorithm() -> Option<&'static str> {
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn get_default_compress() -> Option<bool> {
|
||||
iff!(rust_util_env::is_env_off(TINY_ENCRYPT_ENV_DEFAULT_COMPRESS), Some(true), None)
|
||||
}
|
||||
Reference in New Issue
Block a user