Support deployment CLI flags

This commit is contained in:
hwhung
2026-04-27 12:27:27 +08:00
parent 878cd1eb3c
commit 554ab93df2
2 changed files with 87 additions and 32 deletions
+31 -30
View File
@@ -13,45 +13,46 @@ pnpm dev
If plain `pnpm` is unavailable, use `corepack pnpm` for the same commands. Do not edit `package.json`.
The app runs without `config.json`:
Default startup uses:
- host: `0.0.0.0`
- port: `24731`
- bearer token: `dev-proxy-key`
## Optional Provider Config
## Provider Wiring
Do not create `config.json` unless internal provider endpoints/tokens are available.
Prefer CLI flags. Do not create `config.json` for deployment.
If they are available, create `config.json` in one write with this shape:
If internal provider endpoints/tokens are available, start with:
```json
{
"server": {
"host": "0.0.0.0",
"port": 24731
},
"proxy": {
"apiKey": "dev-proxy-key"
},
"providers": {
"openai": {
"apiKey": "",
"baseURL": ""
},
"anthropic": {
"apiKey": "",
"baseURL": ""
}
},
"logging": {
"level": "info",
"pretty": true
}
}
```bash
pnpm dev -- \
--host 0.0.0.0 \
--port 24731 \
--proxy-api-key dev-proxy-key \
--openai-base-url "<internal-openai-base-url>" \
--openai-api-key "<internal-openai-api-key>" \
--anthropic-base-url "<internal-anthropic-base-url>" \
--anthropic-api-key "<internal-anthropic-api-key>"
```
Fill only `providers.openai.apiKey`, `providers.openai.baseURL`, `providers.anthropic.apiKey`, and `providers.anthropic.baseURL`. Use internal endpoints only. Never use public official provider endpoints.
Use internal endpoints only. Never use public official provider endpoints. Do not print provider tokens.
Supported setup flags:
- `--host`
- `--port`
- `--proxy-api-key`
- `--openai-base-url`
- `--openai-api-key`
- `--anthropic-base-url`
- `--anthropic-api-key`
- `--log-level`
- `--pretty-logs`
- `--no-pretty-logs`
- `--config`
CLI flags override `config.json`. `config.json` is only for local/manual use.
## Verify
@@ -61,4 +62,4 @@ curl -s http://localhost:24731/dashboard | head
curl -s -H "Authorization: Bearer dev-proxy-key" http://localhost:24731/v1/models
```
Expected without provider config: dashboard, health, and model list work; chat completions return `503`.
Expected without provider flags: dashboard, health, and model list work; chat completions return `503`.