diff --git a/runtime/src/environment.rs b/runtime/src/environment.rs index 944f1009..06c9447c 100644 --- a/runtime/src/environment.rs +++ b/runtime/src/environment.rs @@ -1,7 +1,7 @@ use std::env; use std::sync::OnceLock; use log::info; -use rocket::get; +use rocket::{delete, get}; use sys_locale::get_locale; use crate::api_token::APIToken; @@ -70,6 +70,29 @@ pub fn read_enterprise_env_config_id(_token: APIToken) -> String { ) } +#[delete("/system/enterprise/config/id")] +pub fn delete_enterprise_env_config_id(_token: APIToken) -> String { + // + // When we are on a Windows machine, we try to read the enterprise config from + // the Windows registry. In case we can't find the registry key, or we are on a + // macOS or Linux machine, we try to read the enterprise config from the + // environment variables. + // + // The registry key is: + // HKEY_CURRENT_USER\Software\github\MindWork AI Studio\Enterprise IT + // + // In this registry key, we expect the following values: + // - delete_config_id + // + // The environment variable is: + // MINDWORK_AI_STUDIO_ENTERPRISE_DELETE_CONFIG_ID + // + get_enterprise_configuration( + "delete_config_id", + "MINDWORK_AI_STUDIO_ENTERPRISE_DELETE_CONFIG_ID", + ) +} + #[get("/system/enterprise/config/server")] pub fn read_enterprise_env_config_server_url(_token: APIToken) -> String { // diff --git a/runtime/src/runtime_api.rs b/runtime/src/runtime_api.rs index a90b43f1..eece5973 100644 --- a/runtime/src/runtime_api.rs +++ b/runtime/src/runtime_api.rs @@ -79,6 +79,7 @@ pub fn start_runtime_api() { crate::environment::get_config_directory, crate::environment::read_user_language, crate::environment::read_enterprise_env_config_id, + crate::environment::delete_enterprise_env_config_id, crate::environment::read_enterprise_env_config_server_url, crate::file_data::extract_data, crate::file_data::read_pdf,