feat: v1.4.4, support config environment
This commit is contained in:
@@ -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