ruwebframe 0.1.8

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
use crate::rubase::ruconst::ruconst;
use crate::rubase::rudto::cfgdto;
use crate::rubase::rutils;
use crate::rubase::rutils::str_utils;
use crate::rulog::ru_log; 
use spicex::Spice;
use std::fs::File;
use std::io::{BufReader, Read};

pub fn parse_env() -> String {
    let mut p = rutils::find_base_path();
    p = p + ruconst::FILE_PATH_ENV;
    let mut spice = Spice::new();
    spice.set_config_file(p).unwrap();
    let env = spice.get_string("Env").unwrap();

    return env.unwrap();
}

pub fn exist_env(var: &str) -> bool {
    var.contains("$")
}
pub fn parse_env_var(var: String) -> String {
    return str_utils::parse_env_var(var);
}
pub fn parse_env2file() -> String {
    let env_file = parse_env();

    let filename = String::from("ichub-") + &parse_env_var(env_file) + ".yml";
    ru_log::info(filename.as_str());

    return filename;
}
//#[test]
pub fn parse_cfg2file(fileName: String) -> String {
    let mut spice = Spice::new();
    let filepath = String::from("./config/") + &fileName;
    spice.set_config_file(filepath).unwrap();

    let env = spice.get_string("software.env").unwrap();

    return parse_env_var(env.unwrap());
}
pub fn parse_config() {
    let file = File::open("./config/ichub-postgres.yml");
    let mut read = BufReader::new(file.unwrap());
    let mut yaml_str = String::new();
    read.read_to_string(&mut yaml_str).unwrap();

    let ret = serde_yaml::from_str::<cfgdto::cfg_dto::CfgDto>(&yaml_str);
    // ✅ 显式指定类型
    println!("{:#?}", ret);
}