v0.1.0-pre.055

This commit is contained in:
2026-07-26 13:58:14 +02:00
parent 068eb9ece5
commit a3ce8d733f
44 changed files with 7507 additions and 8271 deletions

View File

@@ -1,5 +1,5 @@
// file: kb-app-demo-desktop/src/app_state.rs
// version: 8
// version: 9
//! Shared Tauri application state and startup initialization.
@@ -28,9 +28,12 @@ pub(crate) struct AppState {
impl crate::AppState {
/// Initializes configuration, logging and shared runtime state.
pub(crate) fn initialize() -> kb_core::Result<crate::AppState> {
load_workspace_dotenv();
let config_path = resolve_config_path();
let app_config = match kb_config::read_config_json_file(&config_path) {
let workspace_root = crate::workspace_root_dir();
let app_config = match kb_config::read_config_json_file_with_environment(
&config_path,
&workspace_root,
) {
std::result::Result::Ok(config) => config,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
@@ -180,23 +183,6 @@ impl crate::AppState {
}
}
fn load_workspace_dotenv() {
let workspace_path = crate::workspace_root_dir().join(".env");
load_dotenv_path(&workspace_path);
let desktop_path = crate::workspace_root_dir().join("kb-app-demo-desktop/.env");
load_dotenv_path(&desktop_path);
}
fn load_dotenv_path(path: &std::path::Path) {
let result = dotenvy::from_path(path);
if let std::result::Result::Err(error) = result {
if matches!(error, dotenvy::Error::Io(ref io_error) if io_error.kind() == std::io::ErrorKind::NotFound) {
return;
}
eprintln!("cannot load {}: {error}", path.display());
}
}
fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::LoggingConfig {
let mut targets = std::vec::Vec::<kb_logging::LogTargetConfig>::new();
for target in &config.targets {