Skip to main content

Configuration: Apps, Environments, and Multi-App

Many "I made the right change but it's still hitting the wrong database" issues boil down to the App Code or environment (daily / production) not pointing where you think it does. This section lays out the rules so you can troubleshoot quickly.

Three Core Concepts

App Code: Every application on the platform has a unique identifier. Nearly all CLI commands that read or write data target the "current app" by default.

Configuration file: The .rabetbase.json file in the project root can specify appcode and other settings. A global configuration file can also exist in the user's home directory. For precedence rules, see "Configuration Sources and Precedence" in the Command Reference.

Precedence: What Wins

The short version: CLI flags > environment variables > currently selected app config > top-level defaults in the config file.

Common patterns:

  • Temporarily specify an App Code: rabetbase ... --appcode <code>
  • Switch between apps in a multi-app setup: rabetbase ... --app <app-name-from-config>

This lets you hardcode parameters in scripts while keeping a single set of defaults in your local config file.

Single-App Mode (Most Common)

Set fields at the top level of .rabetbase.json:

{
"appcode": "app-xxxx",
"env": "daily"
}

When you omit --appcode, the CLI uses this value.

Multi-App Mode (Multiple Lovrabet Apps in One Repository)

When a project maintains several apps -- say an "order" app and a "product" app -- use apps + defaultApp:

{
"defaultApp": "order",
"apps": {
"order": {
"appcode": "app-order-xxx",
"env": "production",
"apiDir": "./apps/order/src/api"
},
"product": {
"appcode": "app-product-yyy",
"env": "daily"
}
},
"cookie": "",
"format": "pretty"
}

Top-level fields serve as shared defaults; each apps.<name> entry can override appcode, env, apiDir, cookie, and more.

Switch the default app (writes back to the config file):

rabetbase app use product

List all apps and see which one is the default:

rabetbase app list

Running just rabetbase app is equivalent to app list.

Add a new app:

rabetbase app add <name> --appcode <required-AppCode>

You can also pass --env, --apiDir, --cookie, and so on.

Remove an app:

rabetbase app remove <name>

Managing Config via Commands (No Manual JSON Editing)

When run inside a project directory, these commands modify the project config; otherwise they modify the global config in your home directory:

rabetbase config set appcode app-xxxx
rabetbase config set env daily
rabetbase config get appcode
rabetbase config list

This is convenient for quickly changing one or two values. For complex structures, directly editing the file or relying on version control is still recommended.

Risk Level (riskLevel)

You can set riskLevel in the configuration: read | write | high-risk-write. This controls which commands are allowed to run based on how dangerous they are. For example, setting it to read will reject any write commands. This is commonly used in team standards. For details on the field, see the Command Reference.


Summary

  • Always confirm that App Code and env match the task at hand.
  • In multi-app setups, make it a habit to run app list to check the default, or explicitly specify with --app / --appcode.
  • For the full precedence rules and environment variable names, see the Command Reference.

Next: Run development scripts in your project -- see Daily Development: Running Scripts and Debugging.