1mod handlers;
2mod models;
3
4use clap::Parser;
5use handlers::load::load_yaml_to_env;
6use models::args::Args;
7
8pub fn set_ok(file_type: &str) {
9 let args = Args::parse();
10 let environment = args.branch.as_str();
11
12 match file_type {
13 "env" => {
14 dotenv::from_filename(format!(".env.{}", &environment)).ok();
15 dotenv::dotenv().ok();
16 },
17 "yaml" | "yml" => {
18 let common_path = format!("common.yaml");
19 load_yaml_to_env(&common_path).ok();
20
21 let file_path = format!("{}.{}", &environment, file_type);
22 load_yaml_to_env(&file_path).ok();
23 },
24 _ => {
25 println!("No configuration has been specified. As the default value is 'env', the program will execute using the 'env' configuration.");
26 }
27 }
28}