feat: v1.9.6
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1989,7 +1989,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.9.5"
|
version = "1.9.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-stream",
|
"aes-gcm-stream",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.9.5"
|
version = "1.9.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "A simple and tiny file encrypt tool"
|
description = "A simple and tiny file encrypt tool"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ use std::collections::HashMap;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{env, fs};
|
use std::{env, fs};
|
||||||
|
|
||||||
use rust_util::util_file::resolve_file_path;
|
use rust_util::util_file::resolve_file_path;
|
||||||
use rust_util::{debugging, opt_result, simple_error, warning, XResult};
|
use rust_util::{debugging, opt_result, simple_error, warning, XResult};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -366,20 +365,34 @@ pub fn load_includes_and_merge(mut config: TinyEncryptConfig) -> TinyEncryptConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(profiles) = &mut config.profiles {
|
}
|
||||||
let all_key_ids = config.envelops.iter().map(|e| e.kid.clone()).collect::<Vec<_>>();
|
}
|
||||||
if profiles.contains_key("__all__") {
|
if let Some(profiles) = &mut config.profiles {
|
||||||
warning!("Key __all__ in profiles exists")
|
let all_key_ids = config.envelops.iter().map(|e| e.kid.clone()).collect::<Vec<_>>();
|
||||||
} else {
|
if profiles.contains_key("__all__") {
|
||||||
profiles.insert("__all__".to_string(), all_key_ids);
|
warning!("Key __all__ in profiles exists")
|
||||||
}
|
} else {
|
||||||
}
|
profiles.insert("__all__".to_string(), all_key_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn search_include_configs(includes_path: &str) -> Vec<TinyEncryptConfig> {
|
pub fn search_include_configs(includes_path: &str) -> Vec<TinyEncryptConfig> {
|
||||||
|
let includes_path = if includes_path.starts_with("$") {
|
||||||
|
let includes_path_env_var = includes_path.chars().skip(1).collect::<String>();
|
||||||
|
match env::var(&includes_path_env_var) {
|
||||||
|
Ok(includes_path) => includes_path,
|
||||||
|
Err(e) => {
|
||||||
|
warning!("Cannot find env var: {}, failed: {}", &includes_path_env_var, e);
|
||||||
|
return vec![];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
includes_path.to_string()
|
||||||
|
};
|
||||||
|
|
||||||
|
let includes_path = &includes_path;
|
||||||
let mut sub_configs = vec![];
|
let mut sub_configs = vec![];
|
||||||
let read_dir = match fs::read_dir(includes_path) {
|
let read_dir = match fs::read_dir(includes_path) {
|
||||||
Ok(read_dir) => read_dir,
|
Ok(read_dir) => read_dir,
|
||||||
|
|||||||
Reference in New Issue
Block a user