remove junk config at root

This commit is contained in:
rambros 2026-03-06 12:16:07 +05:30
parent fe5e680fa4
commit a2e57bb158
3 changed files with 6 additions and 18 deletions

View file

@ -5,7 +5,7 @@ from src.core.configuration import load_config
def setup_logging(): def setup_logging():
try: try:
config = load_config() config = load_config(create_if_missing=False)
log_level_str = config.migration.log_level.upper() log_level_str = config.migration.log_level.upper()
level = getattr(logging, log_level_str, logging.INFO) level = getattr(logging, log_level_str, logging.INFO)
except Exception: except Exception:

View file

@ -54,9 +54,12 @@ class AppConfig(BaseModel):
def stoat_api_url(self) -> Optional[str]: def stoat_api_url(self) -> Optional[str]:
return self.target_api_url if self.target_platform == "stoat" else None return self.target_api_url if self.target_platform == "stoat" else None
def load_config(config_path: Union[str, Path] = "config.yaml") -> AppConfig: def load_config(config_path: Union[str, Path] = "config.yaml", create_if_missing: bool = True) -> AppConfig:
path = Path(config_path) path = Path(config_path)
if not path.exists(): if not path.exists():
if not create_if_missing:
raise FileNotFoundError(f"Configuration file not found: {config_path}")
config = AppConfig( config = AppConfig(
discord_bot_token="DISCORD_BOT_TOKEN", discord_bot_token="DISCORD_BOT_TOKEN",
discord_server_id="DISCORD_SERVER_ID", discord_server_id="DISCORD_SERVER_ID",

View file

@ -168,21 +168,6 @@ class BackupPane(Container):
modal.write(f" Channels: [green]{len(getattr(server, 'channels', []))}[/green]") modal.write(f" Channels: [green]{len(getattr(server, 'channels', []))}[/green]")
modal.write("") modal.write("")
modal.show_info("[bold cyan]Profile Backup Ready[/bold cyan]", f"Overview: {len(server.channels) if server else '?'} Channels, {len(server.roles) if server else '?'} Roles")
modal.set_status("Awaiting Confirmation to Backup Profile...")
choice = await modal.phase_wait_confirm(
btn_start_label="Start Backup",
show_id=False
)
if choice in ("btn_back", "btn_main_menu"):
modal.dismiss()
self.engine.is_running = False
await self.engine.close_connections()
if choice == "btn_main_menu":
self.app.switch_screen("config_selection")
return
modal.cancel_callback = lambda: setattr(self.engine, "is_running", False) modal.cancel_callback = lambda: setattr(self.engine, "is_running", False)
modal.phase_progress() modal.phase_progress()
modal.set_status("Exporting Server Structure...") modal.set_status("Exporting Server Structure...")
@ -417,7 +402,7 @@ class BackupPane(Container):
modal_prog.write(f" Roles: [green]{len(getattr(server, 'roles', []))}[/green]") modal_prog.write(f" Roles: [green]{len(getattr(server, 'roles', []))}[/green]")
modal_prog.write(f" Emojis: [green]{len(getattr(server, 'emojis', []))}[/green]") modal_prog.write(f" Emojis: [green]{len(getattr(server, 'emojis', []))}[/green]")
modal_prog.write(f" Channels: [green]{len(getattr(server, 'channels', []))}[/green]") modal_prog.write(f" Channels: [green]{len(getattr(server, 'channels', []))}[/green]")
modal_prog.write("\n[dim]This operation will update the profile and scan existing baked-up channels for new messages.[/dim]") modal_prog.write("\n[dim]This operation will update the profile and scan existing backed-up channels for new messages.[/dim]")
modal_prog.write("") modal_prog.write("")
modal_prog.show_info("[bold green]Sync Ready[/bold green]", f"Overview: {len(server.channels) if server else '?'} Channels") modal_prog.show_info("[bold green]Sync Ready[/bold green]", f"Overview: {len(server.channels) if server else '?'} Channels")