-
Notifications
You must be signed in to change notification settings - Fork 2
feat(cli): add config management via ~/.vlmrun/config.toml #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
vlmrun/cli/_cli/config.py
Outdated
| CONFIG_FILE = Path.home() / ".vlmrun" / "config.toml" | ||
|
|
||
|
|
||
| def get_config() -> dict: |
There was a problem hiding this comment.
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.
vlmrun/cli/_cli/config.py
Outdated
| return | ||
|
|
||
| display_config = config.copy() | ||
| if "api_key" in display_config: |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
PR Description
Fixes #56
Add support for persistent configuration:
vlmrun config showto display current settingsvlmrun config set --api-key/--base-urlto update valuesvlmrun config unset --api-key/--base-urlto remove values