Configuration reference
This page covers the rabetbase-cli configuration system: config file fields, single-app and multi-app modes, and managing configuration from the command line.
1. Config file overview
rabetbase-cli uses JSON config files in two scopes:
| Scope | Location | Notes |
|---|---|---|
| Project | Project root **./. **``rabetbase.json | Applies to the current project only; takes precedence |
| Global | User HOME **~ **``/.``rabetbase.json | Shared by all projects; acts as the fallback |
2. Initializing configuration
# 交互式创建项目配置
cd your-project/
rabetbase project initEnter the AppCode and environment when prompted; .rabetbase.json is generated automatically.
3. Configuration fields
3.1 Top-level fields
| Field | Type | Default | Description |
|---|---|---|---|
appcode | string | — | Required (single-app mode). The app code, obtained from the Lovrabet platform. Legacy alias: app |
env | string | "production" | Environment. Values: production, daily. online maps automatically to production |
locale | string | "en-US" | Language setting |
cookie | string | — | Inline session cookie. When set, it takes precedence over the ~/.lovrabet/cookie file |
accessKey | string | — | Access Key authentication (reserved) |
format | string | — | Default output format. Values: json, pretty, table |
pageSize | number | — | Default page size for paginated commands such as sql list |
riskLevel | string | "high-risk-write" | The maximum risk level allowed. Values: read, write, high-risk-write. Legacy alias: maxRisk |
apiDir | string | "./src/api" | Output directory for code generated by api pull |
template_base_url | string | Platform default CDN | Template CDN base URL |
defaultApp | string | — | Default app name in multi-app mode |
apps | object | — | Multi-app config. Keys are app names; values are AppProfiles |
apiDomain | string | Platform default | Custom API domain (standalone deployments) |
userDomain | string | Platform default | Custom user domain |
runtimeDomain | string | Platform default | Custom runtime domain |
3.2 AppProfile fields (each app under apps.* in multi-app mode)
| Field | Type | Description |
|---|---|---|
appcode | string | Required. The app's appcode |
env | string | Overrides top-level env |
apiDir | string | Overrides top-level apiDir |
cookie | string | Overrides top-level cookie |
accessKey | string | Overrides top-level accessKey |
format | string | Overrides top-level format |
pageSize | number | Overrides top-level pageSize |
riskLevel | string | Overrides top-level riskLevel |
locale | string | Overrides top-level locale |
4. Single-app mode
One project connects to a single Lovrabet app.
Minimal config
{
"appcode": "app-7786baaf",
"env": "daily"
}Full example
{
"appcode": "app-7786baaf",
"env": "daily",
"riskLevel": "high-risk-write",
"format": "json",
"apiDir": "./src/api"
}Configuring via commands
# 设置环境
rabetbase config set env daily
# 设置输出目录
rabetbase config set apiDir ./src/api
# 设置风险等级
rabetbase config set riskLevel high-risk-write
# 写入全局配置(加 --global)
rabetbase config set apiDomain https://your-api.example.com --global5. Multi-app mode
One project connects to multiple Lovrabet apps using apps + defaultApp.
Example config
{
"defaultApp": "order",
"apps": {
"order": {
"appcode": "app-8b7d35a1",
"env": "daily",
"riskLevel": "write"
},
"product": {
"appcode": "app-8b7d35a2",
"env": "production",
"apiDir": "./src/api/product"
}
}
}Managing multiple apps via commands
# 添加应用
rabetbase app add order --appcode app-order-001 --env daily
rabetbase app add product --appcode app-product-002
# 切换默认应用
rabetbase app use order
# 查看已配置的应用
rabetbase app list
# 删除应用
rabetbase app remove productSelecting an app with --app
Switch the target app per command with --app:
# 查询 order 应用的数据集
rabetbase dataset list --app order
# 查询 product 应用的 SQL
rabetbase sql list --app product
# 拉取 order 应用的 API
rabetbase api pull --app orderSpecifying directly with --appcode
If you know the appcode and don't want to set up an app profile, pass --appcode directly:
rabetbase dataset list --appcode app-8b7d35a1The CLI automatically looks up the matching profile in apps (cookie, env, and so on).
6. Standalone deployment domain configuration
If Lovrabet is deployed under custom domains, override the defaults with three fields:
# 写入全局配置(所有项目生效)
rabetbase config set apiDomain https://your-api.example.com --global
rabetbase config set userDomain https://your-user.example.com --global
rabetbase config set runtimeDomain https://your-runtime.example.com --globalYou can also put them directly in the project config:
{
"appcode": "app-xxx",
"apiDomain": "https://your-api.example.com",
"userDomain": "https://your-user.example.com",
"runtimeDomain": "https://your-runtime.example.com"
}7. Environment variables
All environment variables are prefixed with RABETBASE_, with legacy LOVRABET_ still accepted. From v2.2.2, business-targeting fields are more conservative: RABETBASE_APPCODE / LOVRABET_APPCODE no longer override project config automatically. To use an AppCode stored in an environment variable in a script, pass it explicitly to --appcode.
| Environment variable | Config field | Description |
|---|---|---|
RABETBASE_APPCODE | — | A shell variable only, for scripts to pass explicitly to --appcode; business commands refuse to run if a conflict is detected |
RABETBASE_ENV | env | Environment fallback when the project has no env |
RABETBASE_COOKIE | cookie | Session cookie |
RABETBASE_ACCESS_KEY | accessKey | Access Key |
RABETBASE_FORMAT | format | Output format |
RABETBASE_PAGE_SIZE | pageSize | Page size |
RABETBASE_RISK_LEVEL | riskLevel | Maximum risk level |
RABETBASE_VERBOSE | — | Global verbose switch (1 or true) |
RABETBASE_APP | — | App name at runtime (equivalent to --app) |
Example for CI:
export RABETBASE_APPCODE=app-xxx
export RABETBASE_ENV=daily
rabetbase dataset list --appcode "$RABETBASE_APPCODE"8. Precedence overview
You can read the resolution rules for common config fields like this:
CLI flag (--appcode, --env, --format, --app ...)
↓
当前项目 app profile / 项目顶层配置
↓
环境变量中的辅助选择 (RABETBASE_APP、RABETBASE_ENV)
↓
全局 app profile / 全局顶层配置
↓
内置默认值--appcode is the exception: it only accepts a value passed explicitly on the command line. Even if RABETBASE_APPCODE exists in your shell, the CLI will not silently treat it as the business AppCode. This prevents commands from accidentally hitting the previous project's app while switching between projects.
Environment variables fit these two scenarios best:
# 1. 用 RABETBASE_APP 临时选择已配置的 app profile
RABETBASE_APP=order rabetbase dataset list
# 2. 在 CI 中保存 AppCode,但执行命令时显式传入
rabetbase dataset list --appcode "$RABETBASE_APPCODE"9. Command cheat sheet
# 查看合并后的完整配置
rabetbase config list
# 读取单个配置项
rabetbase config get apiDomain
# 写入项目级配置
rabetbase config set env daily
# 写入全局配置
rabetbase config set apiDomain https://custom-api.example.com --global
# 诊断配置问题
rabetbase doctor
# 多应用管理
rabetbase app add --appcode
rabetbase app use
rabetbase app list
rabetbase app remove