pub(crate) fn set_env_for_config(
    env: IndexMap<String, EnvValue>,
    additional_profiles: Option<&Vec<String>>,
    allow_sub_env: bool,
) {
    debug!("Setting Up Env.");

    for (key, env_value) in &env {
        debug!("Setting env: {} = {:#?}", &key, &env_value);

        match *env_value {
            EnvValue::Value(ref value) => evaluate_and_set_env(&key, value),
            EnvValue::Boolean(value) => set_env_for_bool(&key, value),
            EnvValue::Number(value) => evaluate_and_set_env(&key, &value.to_string()),
            EnvValue::List(ref value) => set_env_for_list(&key, value),
            EnvValue::Script(ref script_info) => set_env_for_script(&key, script_info),
            EnvValue::Decode(ref decode_info) => set_env_for_decode_info(&key, decode_info),
            EnvValue::Conditional(ref conditioned_value) => {
                set_env_for_conditional_value(&key, conditioned_value)
            }
            EnvValue::PathGlob(ref path_glob_info) => set_env_for_path_glob(&key, path_glob_info),
            EnvValue::Profile(ref sub_env) => {
                if allow_sub_env {
                    set_env_for_profile(&key, sub_env, additional_profiles)
                }
            }
            EnvValue::Unset(ref value) => {
                if value.unset {
                    unset_env(&key);
                }
            }
        };
    }

    if allow_sub_env {
        let profile_name = profile::get();

        if env.contains_key(&profile_name) {
            match env.get(&profile_name) {
                Some(ref env_value) => {
                    match *env_value {
                        EnvValue::Profile(ref sub_env) => {
                            set_env_for_profile(&profile_name, sub_env, None)
                        }
                        _ => (),
                    };
                }
                None => (),
            };
        }
    }
}
Updates the env based on the provided data
src/lib/environment/mod.rs