m
This commit is contained in:
@@ -354,19 +354,6 @@ def reload_config(
|
|||||||
return load_config(config_dir=config_dir, filename=filename)
|
return load_config(config_dir=config_dir, filename=filename)
|
||||||
|
|
||||||
|
|
||||||
def _validate_config_safety(config: Dict[str, Any]) -> None:
|
|
||||||
"""Validate configuration safety.
|
|
||||||
|
|
||||||
Folder store validation has been removed because the folder store backend
|
|
||||||
is no longer supported.
|
|
||||||
"""
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def _serialize_conf(config: Dict[str, Any]) -> str:
|
|
||||||
"""Serialize configuration to a string for legacy .conf files."""
|
|
||||||
return json.dumps(config, indent=4)
|
|
||||||
|
|
||||||
|
|
||||||
def save_config(
|
def save_config(
|
||||||
config: Dict[str, Any],
|
config: Dict[str, Any],
|
||||||
@@ -405,16 +392,6 @@ def save_config(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"Failed to save config to database: {e}")
|
log(f"Failed to save config to database: {e}")
|
||||||
|
|
||||||
# 2. Legacy fallback: write to .conf for now (optional, but keep for backward compat for a bit)
|
|
||||||
if config_path.suffix.lower() == ".conf":
|
|
||||||
# Safety Check: placeholder (folder store validation removed)
|
|
||||||
_validate_config_safety(config)
|
|
||||||
|
|
||||||
try:
|
|
||||||
config_path.write_text(_serialize_conf(config), encoding="utf-8")
|
|
||||||
except OSError as exc:
|
|
||||||
log(f"Failed to write legacy config to {config_path}: {exc}")
|
|
||||||
|
|
||||||
cache_key = _make_cache_key(config_dir, filename, config_path)
|
cache_key = _make_cache_key(config_dir, filename, config_path)
|
||||||
_CONFIG_CACHE[cache_key] = config
|
_CONFIG_CACHE[cache_key] = config
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from textual.widgets import Static, Button, Input, Label, ListView, ListItem, Ru
|
|||||||
from textual import on, work
|
from textual import on, work
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from SYS.config import load_config, save_config, global_config
|
from SYS.config import load_config, save_config, global_config
|
||||||
from Store.registry import _discover_store_classes, _required_keys_for
|
from Store.registry import _discover_store_classes, _required_keys_for
|
||||||
from ProviderCore.registry import list_providers
|
from ProviderCore.registry import list_providers
|
||||||
@@ -111,12 +110,10 @@ class ConfigModal(ModalScreen):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
# Load config from the workspace root (parent of SYS)
|
# Load config from the workspace root (parent of SYS)
|
||||||
workspace_root = Path(__file__).resolve().parent.parent.parent
|
self.config_data = load_config()
|
||||||
self.config_data = load_config(config_dir=workspace_root)
|
|
||||||
self.current_category = "globals"
|
self.current_category = "globals"
|
||||||
self.editing_item_type = None # 'store' or 'provider'
|
self.editing_item_type = None # 'store' or 'provider'
|
||||||
self.editing_item_name = None
|
self.editing_item_name = None
|
||||||
self.workspace_root = workspace_root
|
|
||||||
self._button_id_map = {}
|
self._button_id_map = {}
|
||||||
self._input_id_map = {}
|
self._input_id_map = {}
|
||||||
|
|
||||||
@@ -738,7 +735,7 @@ class ConfigModal(ModalScreen):
|
|||||||
self._update_config_value(event.select.id, event.value)
|
self._update_config_value(event.select.id, event.value)
|
||||||
|
|
||||||
def save_all(self) -> None:
|
def save_all(self) -> None:
|
||||||
save_config(self.config_data, config_dir=self.workspace_root)
|
save_config(self.config_data)
|
||||||
|
|
||||||
def validate_current_editor(self) -> bool:
|
def validate_current_editor(self) -> bool:
|
||||||
"""Ensure all required fields for the current item are filled."""
|
"""Ensure all required fields for the current item are filled."""
|
||||||
|
|||||||
Reference in New Issue
Block a user