Show current configuration.
()
| 563 | |
| 564 | |
| 565 | def show_config(): |
| 566 | """Show current configuration.""" |
| 567 | console = Console() |
| 568 | |
| 569 | try: |
| 570 | from src.config import load_config, get_config_path |
| 571 | |
| 572 | config = load_config() |
| 573 | config_path = get_config_path() |
| 574 | |
| 575 | console.print(f"\n[bold]Configuration File:[/bold] {config_path}\n") |
| 576 | console.print("[bold]Current Configuration:[/bold]\n") |
| 577 | |
| 578 | console.print(f"[cyan]Default Provider:[/cyan] {config.get('default_provider', 'Not set')}") |
| 579 | |
| 580 | console.print("\n[cyan]Configured Providers:[/cyan]") |
| 581 | for provider_name, provider_config in config.get("providers", {}).items(): |
| 582 | api_key = provider_config.get("api_key", "") |
| 583 | masked_key = f"{api_key[:8]}...{api_key[-4:]}" if len(api_key) > 12 else "Not set" |
| 584 | |
| 585 | console.print(f"\n [yellow]{provider_name.upper()}:[/yellow]") |
| 586 | console.print(f" API Key: {masked_key}") |
| 587 | console.print(f" Base URL: {provider_config.get('base_url', 'Not set')}") |
| 588 | console.print(f" Default Model: {provider_config.get('default_model', 'Not set')}") |
| 589 | |
| 590 | # Stored API keys (config "env" block, e.g. TAVILY_API_KEY). Values are |
| 591 | # masked — only the name and a hint are shown. |
| 592 | from src.secret_store import get_secret, list_secret_names |
| 593 | |
| 594 | stored_names = list_secret_names() |
| 595 | if stored_names: |
| 596 | console.print("\n[cyan]Stored Keys (env):[/cyan]") |
| 597 | for name in stored_names: |
| 598 | value = get_secret(name) or "" |
| 599 | masked = f"{value[:4]}...{value[-4:]}" if len(value) > 10 else "Set" |
| 600 | console.print(f" {name}: {masked}") |
| 601 | |
| 602 | console.print() |
| 603 | |
| 604 | except Exception as e: |
| 605 | console.print(f"\n[red]Error loading configuration: {e}[/red]\n") |
| 606 | return 1 |
| 607 | |
| 608 | return 0 |
| 609 | |
| 610 | |
| 611 | if __name__ == '__main__': |
no test coverage detected