feat: v1.5.3, environment support vec string
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1700,7 +1700,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.5.2"
|
version = "1.5.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-stream",
|
"aes-gcm-stream",
|
||||||
"base64",
|
"base64",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tiny-encrypt"
|
name = "tiny-encrypt"
|
||||||
version = "1.5.2"
|
version = "1.5.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "A simple and tiny file encrypt tool"
|
description = "A simple and tiny file encrypt tool"
|
||||||
|
|||||||
@@ -36,12 +36,19 @@ use crate::spec::TinyEncryptEnvelopType;
|
|||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct TinyEncryptConfig {
|
pub struct TinyEncryptConfig {
|
||||||
pub environment: Option<HashMap<String, String>>,
|
pub environment: Option<HashMap<String, StringOrVecString>>,
|
||||||
pub namespaces: Option<HashMap<String, String>>,
|
pub namespaces: Option<HashMap<String, String>>,
|
||||||
pub envelops: Vec<TinyEncryptConfigEnvelop>,
|
pub envelops: Vec<TinyEncryptConfigEnvelop>,
|
||||||
pub profiles: HashMap<String, Vec<String>>,
|
pub profiles: HashMap<String, Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StringOrVecString {
|
||||||
|
String(String),
|
||||||
|
Vec(Vec<String>),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct TinyEncryptConfigEnvelop {
|
pub struct TinyEncryptConfigEnvelop {
|
||||||
@@ -81,6 +88,10 @@ impl TinyEncryptConfig {
|
|||||||
|
|
||||||
if let Some(environment) = &config.environment {
|
if let Some(environment) = &config.environment {
|
||||||
for (k, v) in environment {
|
for (k, v) in environment {
|
||||||
|
let v = match v {
|
||||||
|
StringOrVecString::String(s) => { s.to_string() }
|
||||||
|
StringOrVecString::Vec(vs) => { vs.join(",") }
|
||||||
|
};
|
||||||
debugging!("Set env: {}={}", k, v);
|
debugging!("Set env: {}={}", k, v);
|
||||||
env::set_var(k, v);
|
env::set_var(k, v);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user