info!("Trying to read the enterprise environment for some predefined configuration.");
cfg_if::cfg_if!{
if#[cfg(target_os = "windows")]{
info!(r"Detected a Windows machine, trying to read the registry key 'HKEY_CURRENT_USER\Software\github\MindWork AI Studio\Enterprise IT' or environment variables.");
usewindows_registry::*;
letkey_path=r"Software\github\MindWork AI Studio\Enterprise IT";
letkey=matchCURRENT_USER.open(key_path){
Ok(key)=>key,
Err(_)=>{
info!(r"Could not read the registry key HKEY_CURRENT_USER\Software\github\MindWork AI Studio\Enterprise IT. Falling back to environment variables.");
returnmatchenv::var(env_name){
Ok(val)=>{
info!("Falling back to the environment variable '{}' was successful.",env_name);
val
},
Err(_)=>{
info!("Falling back to the environment variable '{}' was not successful. It appears that this is not an enterprise environment.",env_name);
"".to_string()
},
}
},
};
matchkey.get_string(_reg_value){
Ok(val)=>val,
Err(_)=>{
info!(r"We could read the registry key 'HKEY_CURRENT_USER\Software\github\MindWork AI Studio\Enterprise IT', but the value '{}' could not be read. Falling back to environment variables.",_reg_value);
matchenv::var(env_name){
Ok(val)=>{
info!("Falling back to the environment variable '{}' was successful.",env_name);
val
},
Err(_)=>{
info!("Falling back to the environment variable '{}' was not successful. It appears that this is not an enterprise environment.",env_name);
"".to_string()
}
}
},
}
}else{
// In the case of macOS or Linux, we just read the environment variable:
info!(r"Detected a Unix machine, trying to read the environment variable '{}'.",env_name);
matchenv::var(env_name){
Ok(val)=>val,
Err(_)=>{
info!("The environment variable '{}' was not found. It appears that this is not an enterprise environment.",env_name);