use crate::writers::write_to_file;
use crate::Project;
use color_eyre::eyre::Result;
use eyre::Error;
use rand::distr::Alphanumeric;
use rand::RngExt;
pub fn set_env(project: &Project) -> Result<String, Error> {
let random_string: String = rand::rng()
.sample_iter(Alphanumeric)
.take(100)
.map(char::from)
.collect();
let contents = format!("SECRET_KEY={};", random_string);
let mut result = "success".to_string();
write_to_file(&project.env, contents.as_bytes()).unwrap_or_else(|why| {
result = why.to_string();
});
Ok(result)
}