feat: v1.4.4, support config environment
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1700,7 +1700,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.4.3"
|
||||
version = "1.4.4"
|
||||
dependencies = [
|
||||
"aes-gcm-stream",
|
||||
"base64",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tiny-encrypt"
|
||||
version = "1.4.3"
|
||||
version = "1.4.4"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A simple and tiny file encrypt tool"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::{env, fs};
|
||||
|
||||
use rust_util::{debugging, opt_result, simple_error, XResult};
|
||||
use rust_util::util_file::resolve_file_path;
|
||||
@@ -34,6 +34,7 @@ use crate::spec::TinyEncryptEnvelopType;
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TinyEncryptConfig {
|
||||
pub environment: Option<HashMap<String, String>>,
|
||||
pub envelops: Vec<TinyEncryptConfigEnvelop>,
|
||||
pub profiles: HashMap<String, Vec<String>>,
|
||||
}
|
||||
@@ -74,6 +75,14 @@ impl TinyEncryptConfig {
|
||||
}
|
||||
}
|
||||
config.profiles = splited_profiles;
|
||||
|
||||
if let Some(environment) = &config.environment {
|
||||
for (k, v) in environment {
|
||||
debugging!("Set env: {}={}", k, v);
|
||||
env::set_var(k, v);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user