simplify log level config
This commit is contained in:
parent
3b3b262d8b
commit
dc59b21bee
3 changed files with 10 additions and 14 deletions
|
|
@ -3,10 +3,6 @@ import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
class MigrationSettings(BaseModel):
|
|
||||||
batch_size: int = Field(default=100)
|
|
||||||
log_level: str = Field(default="DEBUG")
|
|
||||||
|
|
||||||
class AppConfig(BaseModel):
|
class AppConfig(BaseModel):
|
||||||
discord_bot_token: Optional[str] = Field(default=None)
|
discord_bot_token: Optional[str] = Field(default=None)
|
||||||
discord_server_id: Optional[str] = Field(default=None)
|
discord_server_id: Optional[str] = Field(default=None)
|
||||||
|
|
@ -15,7 +11,7 @@ class AppConfig(BaseModel):
|
||||||
target_bot_token: Optional[str] = Field(default=None)
|
target_bot_token: Optional[str] = Field(default=None)
|
||||||
target_server_id: Optional[str] = Field(default=None)
|
target_server_id: Optional[str] = Field(default=None)
|
||||||
target_api_url: Optional[str] = Field(default=None)
|
target_api_url: Optional[str] = Field(default=None)
|
||||||
migration: MigrationSettings = Field(default_factory=MigrationSettings)
|
log_level: str = Field(default="DEBUG")
|
||||||
|
|
||||||
# ── backward‑compat shims (read‑only) ────────────────────────────────
|
# ── backward‑compat shims (read‑only) ────────────────────────────────
|
||||||
# The rest of the codebase (fluxer/stoat modules) still reads these.
|
# The rest of the codebase (fluxer/stoat modules) still reads these.
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ class BackupPane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_backup_profile(self) -> None:
|
async def run_backup_profile(self) -> None:
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
modal.phase_progress()
|
modal.phase_progress()
|
||||||
|
|
@ -214,7 +214,7 @@ class BackupPane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_backup_messages(self) -> None:
|
async def run_backup_messages(self) -> None:
|
||||||
modal_prog = ProgressScreen(log_level=self.config.migration.log_level)
|
modal_prog = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal_prog)
|
self.app.push_screen(modal_prog)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|
@ -273,7 +273,7 @@ class BackupPane(Container):
|
||||||
selected_channels = [c for c in eligible_channels if c.id in selected_ids]
|
selected_channels = [c for c in eligible_channels if c.id in selected_ids]
|
||||||
|
|
||||||
# Phase 2: Confirmation
|
# Phase 2: Confirmation
|
||||||
modal_prog = ProgressScreen(log_level=self.config.migration.log_level) # Re-instantiate to avoid Textual re-push UI freeze
|
modal_prog = ProgressScreen(log_level=self.config.log_level) # Re-instantiate to avoid Textual re-push UI freeze
|
||||||
self.app.push_screen(modal_prog)
|
self.app.push_screen(modal_prog)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|
@ -398,7 +398,7 @@ class BackupPane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_backup_sync(self) -> None:
|
async def run_backup_sync(self) -> None:
|
||||||
modal_prog = ProgressScreen(log_level=self.config.migration.log_level)
|
modal_prog = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal_prog)
|
self.app.push_screen(modal_prog)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
modal_prog.phase_progress()
|
modal_prog.phase_progress()
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ class ShuttlePane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_batch_clone(self, selections: list[str]) -> None:
|
async def run_batch_clone(self, selections: list[str]) -> None:
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
connections_started = False
|
connections_started = False
|
||||||
|
|
@ -506,7 +506,7 @@ class ShuttlePane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_batch_sync(self, selections: list[str]) -> None:
|
async def run_batch_sync(self, selections: list[str]) -> None:
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
try:
|
try:
|
||||||
|
|
@ -766,7 +766,7 @@ class ShuttlePane(Container):
|
||||||
migrate_mod = fluxer_migrate if self.target_platform == "fluxer" else stoat_migrate
|
migrate_mod = fluxer_migrate if self.target_platform == "fluxer" else stoat_migrate
|
||||||
platform_name = self.target_platform.capitalize()
|
platform_name = self.target_platform.capitalize()
|
||||||
|
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|
@ -833,7 +833,7 @@ class ShuttlePane(Container):
|
||||||
has_previous = bool(last_migrated)
|
has_previous = bool(last_migrated)
|
||||||
|
|
||||||
# Analyze
|
# Analyze
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|
@ -1041,7 +1041,7 @@ class ShuttlePane(Container):
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def run_batch_danger(self, selections: list[str]) -> None:
|
async def run_batch_danger(self, selections: list[str]) -> None:
|
||||||
modal = ProgressScreen(log_level=self.config.migration.log_level)
|
modal = ProgressScreen(log_level=self.config.log_level)
|
||||||
self.app.push_screen(modal)
|
self.app.push_screen(modal)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
target_started = False
|
target_started = False
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue