Skip to main content

Configuration Reference

This document covers the rabetbase-cli configuration system, including config file fields, single-app and multi-app modes, and managing configuration through CLI commands.


1. Configuration File Overview

rabetbase-cli uses JSON configuration files organized into two scopes:

ScopeFile LocationDescription
Project-level./.rabetbase.json in the project rootApplies only to the current project; takes precedence
Global-level~/.rabetbase.json in the user HOMEShared across all projects; acts as a fallback

Lookup precedence: .rabetbase.json > .lovrabet.json > .lovrabetrc (legacy names supported)

Merge rules: Project-level overrides global-level. Scalar fields are replaced directly; apps is deep-merged.


2. Initializing Configuration

# Interactively create a project configuration
cd your-project/
rabetbase project init

Follow the prompts to enter your AppCode and environment. A .rabetbase.json file will be generated automatically.


3. Configuration Fields Reference

3.1 Top-Level Fields

FieldTypeDefaultDescription
appcodestring--Required (single-app mode). Application code, obtained from the Lovrabet platform. Legacy alias: app
envstring"production"Environment. Accepted values: production, daily. online is automatically mapped to production
localestring"en-US"Language setting
cookiestring--Inline session cookie. When set, takes precedence over the ~/.lovrabet/cookie file
accessKeystring--Access Key authentication (reserved)
formatstring--Default output format. Accepted values: json, pretty, table
pageSizenumber--Default page size, used by paginated commands such as sql list
riskLevelstring"high-risk-write"Maximum allowed risk level. Accepted 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 configuration. Keys are app names; values are AppProfile objects
apiDomainstringPlatform defaultCustom API domain (for self-hosted deployments)
userDomainstringPlatform defaultCustom user domain
runtimeDomainstringPlatform defaultCustom runtime domain

3.2 AppProfile Fields (each entry in apps.* in multi-app mode)

FieldTypeDescription
appcodestringRequired. The appcode for this app
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

A project connected to a single Lovrabet application.

Minimal Configuration

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

Full Configuration Example

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

Setting Configuration via Commands

# Set environment
rabetbase config set env daily

# Set output directory
rabetbase config set apiDir ./src/api

# Set risk level
rabetbase config set riskLevel high-risk-write

# Write to global configuration (add --global)
rabetbase config set apiDomain https://your-api.example.com --global


5. Multi-App Mode

A project connected to multiple Lovrabet applications, using apps + defaultApp.

Configuration Example

{
"defaultApp": "order",
"apps": {
"order": {
"appcode": "app-8b7d35a1",
"env": "daily",
"riskLevel": "write"
},
"product": {
"appcode": "app-8b7d35a2",
"env": "production",
"apiDir": "./src/api/product"
}
}
}

Managing Multi-App via Commands

# Add an app
rabetbase app add order --appcode app-order-001 --env daily
rabetbase app add product --appcode app-product-002

# Switch the default app
rabetbase app use order

# List configured apps
rabetbase app list

# Remove an app
rabetbase app remove product

Specifying an App with --app

Use --app to switch the target app when running a command:

# Query datasets for the "order" app
rabetbase dataset list --app order

# Query SQL for the "product" app
rabetbase sql list --app product

# Pull APIs for the "order" app
rabetbase api pull --app order

Specifying Appcode Directly with --appcode

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

rabetbase dataset list --appcode app-8b7d35a1

The CLI will automatically look up the matching profile in apps (for cookie, env, etc.).


6. Self-Hosted Domain Configuration

If Lovrabet is deployed under a custom domain, override the defaults with these three fields:

# Write to global configuration (applies to all projects)
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 add them directly to the project configuration:

{
"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 use the RABETBASE_ prefix. The legacy prefix LOVRABET_ is also supported. Since v2.2.2, business-target fields are more conservative: RABETBASE_APPCODE / LOVRABET_APPCODE do not override project config automatically. If a script stores AppCode in an environment variable, pass it explicitly with --appcode.

Environment VariableConfig FieldDescription
RABETBASE_APPCODE--Shell variable for scripts; pass it explicitly to --appcode. Commands stop if this variable conflicts with the resolved app
RABETBASE_ENVenvEnvironment fallback when the project does not define one
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--Specify app name at runtime (equivalent to --app)

CI environment example:

export RABETBASE_APPCODE=app-xxx
export RABETBASE_ENV=daily
rabetbase dataset list --appcode "$RABETBASE_APPCODE"


8. Precedence Overview

For common fields, read the resolution order like this:

CLI flag (--appcode, --env, --format, --app ...)
|
v
Current project app profile / project-level config
|
v
Helper environment variables (RABETBASE_APP, RABETBASE_ENV)
|
v
Global app profile / global-level config
|
v
Built-in defaults

--appcode is the exception: it only uses a value passed on the command line. Even if RABETBASE_APPCODE exists in the shell, the CLI will not silently use it as the business AppCode. This prevents commands from accidentally targeting an app left over from another project.

Environment variables are best used in these two cases:

# 1. Select a configured app profile for this shell command
RABETBASE_APP=order rabetbase dataset list

# 2. Keep AppCode in CI, but pass it explicitly
rabetbase dataset list --appcode "$RABETBASE_APPCODE"

9. Command Quick Reference

# View the merged configuration
rabetbase config list

# Read a single config field
rabetbase config get apiDomain

# Write to project-level configuration
rabetbase config set env daily

# Write to global configuration
rabetbase config set apiDomain https://custom-api.example.com --global

# Diagnose configuration issues
rabetbase doctor

# Multi-app management
rabetbase app add <name> --appcode <code>
rabetbase app use <name>
rabetbase app list
rabetbase app remove <name>