Added delete endpoint for enterprise config ID

This commit is contained in:
Thorsten Sommer 2025-06-01 20:45:10 +02:00
parent 86f52550e2
commit f4b203863c
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 25 additions and 1 deletions

View File

@ -1,7 +1,7 @@
use std::env; use std::env;
use std::sync::OnceLock; use std::sync::OnceLock;
use log::info; use log::info;
use rocket::get; use rocket::{delete, get};
use sys_locale::get_locale; use sys_locale::get_locale;
use crate::api_token::APIToken; 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")] #[get("/system/enterprise/config/server")]
pub fn read_enterprise_env_config_server_url(_token: APIToken) -> String { pub fn read_enterprise_env_config_server_url(_token: APIToken) -> String {
// //

View File

@ -79,6 +79,7 @@ pub fn start_runtime_api() {
crate::environment::get_config_directory, crate::environment::get_config_directory,
crate::environment::read_user_language, crate::environment::read_user_language,
crate::environment::read_enterprise_env_config_id, crate::environment::read_enterprise_env_config_id,
crate::environment::delete_enterprise_env_config_id,
crate::environment::read_enterprise_env_config_server_url, crate::environment::read_enterprise_env_config_server_url,
crate::file_data::extract_data, crate::file_data::extract_data,
crate::file_data::read_pdf, crate::file_data::read_pdf,