Handle legacy TUI config directory cleanup
Added support for deleting and recreating the legacy TUI config directory (~/.openrag/tui/config/) during the config reset process. This ensures old configuration files are properly removed alongside the current config directory.
This commit is contained in:
parent
38e8b23ccd
commit
4bd321e7c0
2 changed files with 11 additions and 0 deletions
|
|
@ -79,6 +79,7 @@ class EnvConfig:
|
||||||
openrag_config_path: str = "$HOME/.openrag/config"
|
openrag_config_path: str = "$HOME/.openrag/config"
|
||||||
openrag_data_path: str = "$HOME/.openrag/data" # Backend data (conversations, tokens, etc.)
|
openrag_data_path: str = "$HOME/.openrag/data" # Backend data (conversations, tokens, etc.)
|
||||||
opensearch_data_path: str = "$HOME/.openrag/data/opensearch-data"
|
opensearch_data_path: str = "$HOME/.openrag/data/opensearch-data"
|
||||||
|
openrag_tui_config_path_legacy: str = "$HOME/.openrag/tui/config"
|
||||||
|
|
||||||
# Container version (linked to TUI version)
|
# Container version (linked to TUI version)
|
||||||
openrag_version: str = ""
|
openrag_version: str = ""
|
||||||
|
|
|
||||||
|
|
@ -502,6 +502,16 @@ class MonitorScreen(Screen):
|
||||||
# Recreate empty config directory
|
# Recreate empty config directory
|
||||||
config_path.mkdir(parents=True, exist_ok=True)
|
config_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Also delete legacy TUI config folder if it exists (~/.openrag/tui/config/)
|
||||||
|
tui_config_path = expand_path(env_manager.config.openrag_tui_config_path_legacy)
|
||||||
|
if tui_config_path.exists():
|
||||||
|
success, msg = await self.container_manager.clear_directory_with_container(tui_config_path)
|
||||||
|
if not success:
|
||||||
|
# Fallback to regular rmtree if container method fails
|
||||||
|
shutil.rmtree(tui_config_path)
|
||||||
|
# Recreate empty config directory
|
||||||
|
tui_config_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Delete flow backups only if user chose to (and they actually exist)
|
# Delete flow backups only if user chose to (and they actually exist)
|
||||||
if self._check_flow_backups():
|
if self._check_flow_backups():
|
||||||
if delete_backups:
|
if delete_backups:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue