pub fn set_env(args: &HashMap<String, Value>) -> Result<Value>
Expand description
Set an environment variable.
Arguments:
name
- A string slice that contain the environment variable name.value
- A string slice that contain the default environment variable value.
§Examples
use std::collections::HashMap;
use serde_json::value::Value;
use chewdata::updater::tera_helpers::function::string::set_env;
let mut args = HashMap::new();
args.insert("value".to_string(), Value::String("my_var".to_string()));
args.insert("name".to_string(), Value::String("my_key".to_string()));
let value = set_env(&args).unwrap();
assert_eq!("my_var", value.as_str().unwrap());
let value = std::env::var("chewdata:my_key").unwrap();
assert_eq!("my_var", value);