feat: v1.9.6
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1989,7 +1989,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.9.5"
|
||||
version = "1.9.6"
|
||||
dependencies = [
|
||||
"aes-gcm-stream",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.9.5"
|
||||
version = "1.9.6"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A simple and tiny file encrypt tool"
|
||||
|
||||
@@ -3,7 +3,6 @@ use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::{env, fs};
|
||||
|
||||
use rust_util::util_file::resolve_file_path;
|
||||
use rust_util::{debugging, opt_result, simple_error, warning, XResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -366,6 +365,8 @@ 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__") {
|
||||
@@ -374,12 +375,24 @@ pub fn load_includes_and_merge(mut config: TinyEncryptConfig) -> TinyEncryptConf
|
||||
profiles.insert("__all__".to_string(), all_key_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
config
|
||||
}
|
||||
|
||||
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 read_dir = match fs::read_dir(includes_path) {
|
||||
Ok(read_dir) => read_dir,
|
||||
|
||||
Reference in New Issue
Block a user