mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
feat(auth): add --base-url flag to bl auth login
When used with --api-key, validates the key against the specified base URL and persists it to config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,10 @@ export default defineCommand({
|
||||
usage: "bl auth login --api-key <key> | bl auth login --console",
|
||||
options: [
|
||||
{ flag: "--api-key <key>", description: "DashScope API key to store" },
|
||||
{
|
||||
flag: "--base-url <url>",
|
||||
description: "DashScope API base URL (used with --api-key for validation)",
|
||||
},
|
||||
{
|
||||
flag: "--console",
|
||||
description: "Sign in via browser; opens the console login URL in your default browser",
|
||||
@@ -130,8 +134,16 @@ export default defineCommand({
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const baseUrl = (flags.baseUrl as string) || undefined;
|
||||
const effectiveConfig = baseUrl ? { ...config, baseUrl } : config;
|
||||
|
||||
if (!config.dryRun) {
|
||||
await validateKeyAndPersist(config, key);
|
||||
await validateKeyAndPersist(effectiveConfig, key);
|
||||
if (baseUrl) {
|
||||
const existing = readConfigFile() as Record<string, unknown>;
|
||||
existing.base_url = baseUrl;
|
||||
await writeConfigFile(existing);
|
||||
}
|
||||
printQuickStart();
|
||||
} else {
|
||||
emitBare("Would validate and save API key.");
|
||||
|
||||
@@ -25,10 +25,11 @@ Index: [index.md](index.md)
|
||||
|
||||
#### Options
|
||||
|
||||
| Flag | Type | Required | Description |
|
||||
| ----------------- | ------- | -------- | ------------------------------------------------------------------------ |
|
||||
| `--api-key <key>` | string | no | DashScope API key to store |
|
||||
| `--console` | boolean | no | Sign in via browser; opens the console login URL in your default browser |
|
||||
| Flag | Type | Required | Description |
|
||||
| ------------------ | ------- | -------- | ------------------------------------------------------------------------ |
|
||||
| `--api-key <key>` | string | no | DashScope API key to store |
|
||||
| `--base-url <url>` | string | no | DashScope API base URL (used with --api-key for validation) |
|
||||
| `--console` | boolean | no | Sign in via browser; opens the console login URL in your default browser |
|
||||
|
||||
#### Examples
|
||||
|
||||
|
||||
Reference in New Issue
Block a user