diff --git a/backend/qualibrate_app/cli/config.py b/backend/qualibrate_app/cli/config.py index 496d612..94d1587 100644 --- a/backend/qualibrate_app/cli/config.py +++ b/backend/qualibrate_app/cli/config.py @@ -155,6 +155,8 @@ def write_config( if qss.project: project_path = qss.storage.location / qss.project project_path.mkdir(parents=True, exist_ok=True) + if qss.log_folder: + qss.log_folder.mkdir(parents=True, exist_ok=True) if not config_file.parent.exists(): config_file.parent.mkdir(parents=True) common_config[CONFIG_KEY] = qas_exported_data @@ -213,7 +215,7 @@ def write_config( resolve_path=True, path_type=Path, ), - default=Path().home() / ".qualibrate" / "user_storage", + default=QUALIBRATE_PATH / "user_storage", help="Path to user storage directory with qualibrate data.", show_default=True, ) @@ -260,6 +262,7 @@ def config_command( overwrite: bool, static_site_files: Path, storage_type: StorageType, + log_path: Path, user_storage: Path, project: Optional[str], metadata_out_path: str, diff --git a/backend/qualibrate_app/config/models/qualibrate.py b/backend/qualibrate_app/config/models/qualibrate.py index 4cca9a1..4250334 100644 --- a/backend/qualibrate_app/config/models/qualibrate.py +++ b/backend/qualibrate_app/config/models/qualibrate.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import Optional from pydantic import field_serializer @@ -23,6 +24,7 @@ class QualibrateSettingsBase(BaseSettings, Versioned): project: Optional[str] storage: StorageSettingsBase + log_folder: Optional[Path] = None class QualibrateSettingsSetup(QualibrateSettingsBase): diff --git a/backend/tests/api/local_storage/fixtures/settings.py b/backend/tests/api/local_storage/fixtures/settings.py index 98f10c9..ef5e1fe 100644 --- a/backend/tests/api/local_storage/fixtures/settings.py +++ b/backend/tests/api/local_storage/fixtures/settings.py @@ -61,10 +61,11 @@ def settings_path_filled(settings: QualibrateAppSettings, settings_path: Path): tomli_w.dump( { CONFIG_KEY: settings.model_dump( - exclude={"qualibrate"}, mode="json" + exclude={"qualibrate"}, mode="json", exclude_none=True ), QUALIBRATE_CONFIG_KEY: settings.qualibrate.model_dump( - mode="json" + mode="json", + exclude_none=True, ), }, fin,