Skip to content

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:

ScopeLocationNotes
ProjectProject root **./. **``rabetbase.jsonApplies to the current project only; takes precedence
GlobalUser HOME **~ **``/.``rabetbase.jsonShared by all projects; acts as the fallback

2. Initializing configuration ​

bash
# 交互式创建项目配置
cd your-project/
rabetbase project init

Enter the AppCode and environment when prompted; .rabetbase.json is generated automatically.


3. Configuration fields ​

3.1 Top-level fields ​

FieldTypeDefaultDescription
appcodestring—Required (single-app mode). The app code, obtained from the Lovrabet platform. Legacy alias: app
envstring"production"Environment. Values: production, daily. online maps automatically to production
localestring"en-US"Language setting
cookiestring—Inline session cookie. When set, it takes precedence over the ~/.lovrabet/cookie file
accessKeystring—Access Key authentication (reserved)
formatstring—Default output format. Values: json, pretty, table
pageSizenumber—Default page size for paginated commands such as sql list
riskLevelstring"high-risk-write"The maximum risk level allowed. Values: read, write, high-risk-write. Legacy alias: maxRisk
apiDirstring"./src/api"Output directory for code generated by api pull
template_base_urlstringPlatform default CDNTemplate CDN base URL
defaultAppstring—Default app name in multi-app mode
appsobject—Multi-app config. Keys are app names; values are AppProfiles
apiDomainstringPlatform defaultCustom API domain (standalone deployments)
userDomainstringPlatform defaultCustom user domain
runtimeDomainstringPlatform defaultCustom runtime domain

3.2 AppProfile fields (each app under apps.* in multi-app mode) ​

FieldTypeDescription
appcodestringRequired. The app's appcode
envstringOverrides top-level env
apiDirstringOverrides top-level apiDir
cookiestringOverrides top-level cookie
accessKeystringOverrides top-level accessKey
formatstringOverrides top-level format
pageSizenumberOverrides top-level pageSize
riskLevelstringOverrides top-level riskLevel
localestringOverrides top-level locale

4. Single-app mode ​

One project connects to a single Lovrabet app.

Minimal config ​

json
{
  "appcode": "app-7786baaf",
  "env": "daily"
}

Full example ​

json
{
  "appcode": "app-7786baaf",
  "env": "daily",
  "riskLevel": "high-risk-write",
  "format": "json",
  "apiDir": "./src/api"
}

Configuring via commands ​

bash
# 设置环境
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 --global

5. Multi-app mode ​

One project connects to multiple Lovrabet apps using apps + defaultApp.

Example config ​

json
{
  "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 ​

bash
# 添加应用
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 product

Selecting an app with --app ​

Switch the target app per command with --app:

bash
# 查询 order 应用的数据集
rabetbase dataset list --app order

# 查询 product 应用的 SQL
rabetbase sql list --app product

# 拉取 order 应用的 API
rabetbase api pull --app order

Specifying directly with --appcode ​

If you know the appcode and don't want to set up an app profile, pass --appcode directly:

bash
rabetbase dataset list --appcode app-8b7d35a1

The 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:

bash
# 写入全局配置(所有项目生效)
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 --global

You can also put them directly in the project config:

json
{
  "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 variableConfig fieldDescription
RABETBASE_APPCODE—A shell variable only, for scripts to pass explicitly to --appcode; business commands refuse to run if a conflict is detected
RABETBASE_ENVenvEnvironment fallback when the project has no env
RABETBASE_COOKIEcookieSession cookie
RABETBASE_ACCESS_KEYaccessKeyAccess Key
RABETBASE_FORMATformatOutput format
RABETBASE_PAGE_SIZEpageSizePage size
RABETBASE_RISK_LEVELriskLevelMaximum risk level
RABETBASE_VERBOSE—Global verbose switch (1 or true)
RABETBASE_APP—App name at runtime (equivalent to --app)

Example for CI:

bash
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:

plaintext
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:

bash
# 1. 用 RABETBASE_APP 临时选择已配置的 app profile
RABETBASE_APP=order rabetbase dataset list

# 2. 在 CI 中保存 AppCode,但执行命令时显式传入
rabetbase dataset list --appcode "$RABETBASE_APPCODE"

9. Command cheat sheet ​

bash
# 查看合并后的完整配置
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

基于飞书知识库同步生成,内容以飞书源文档为准