Skip to content

Conversation

@kaushikb11
Copy link
Contributor

@kaushikb11 kaushikb11 commented Feb 11, 2025

PR Description

Fixes #56

Add support for persistent configuration:

  • Store API key and base URL in ~/.vlmrun/config.toml
  • Add vlmrun config show to display current settings
  • Add vlmrun config set --api-key/--base-url to update values
  • Add vlmrun config unset --api-key/--base-url to remove values

@kaushikb11 kaushikb11 changed the title feat(cli): add config management via ~/.vlmrun.toml feat(cli): add config management via ~/.vlmrun/config.toml Feb 12, 2025
CONFIG_FILE = Path.home() / ".vlmrun" / "config.toml"


def get_config() -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we load this into a pydantic dataclass? That way it'll also do type validation on load.

return

display_config = config.copy()
if "api_key" in display_config:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to load the config as a pydantic dataclass, so that you have attrs like display_config.api_key etc.

),
base_url: Optional[str] = typer.Option(
DEFAULT_BASE_URL,
None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this to None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the priority goes like this.

base url passed through the cli command >> base url defined through env variable >> base url fetched from saved config >> default base url.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we set it as None, it will override the base url stored in local config.

@kaushikb11 kaushikb11 merged commit bc57438 into main Feb 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vlmrun auth asks user for API key and writes to ~/.vlmrun/config

3 participants