nb env

Manage saved NocoBase CLI envs. An env stores connection details and local runtime information, such as the API address, authentication info, local app path, and database configuration.

Starting from this version, the CLI separates two concepts:

  • current env: the env currently used by the active shell or agent runtime, isolated by NB_SESSION_ID when possible
  • last env: the last env used globally, used as a fallback when session mode is not enabled

Usage

nb env <command>

Subcommands

CommandDescription
nb env addSave a NocoBase API endpoint and switch to this env
nb env currentView the env that is currently in effect
nb env updateUpdate a saved env configuration and automatically handle follow-up sync as needed
nb env listList configured envs
nb env statusView the status of the current env, a specified env, or all envs
nb env infoView detailed information for a single env
nb env removeRemove the env configuration after stopping the managed runtime
nb env authPerform OAuth login for a saved env
nb env useSwitch the current env

Examples

nb env add app1 --api-base-url http://localhost:13000/api
nb env current
nb env list
nb env status
nb env info app1
nb env update app1
nb env use app1
nb env auth app1

session mode

Session mode is recommended by default. It lets the current env in different terminals, shells, or agent runtimes stay isolated from one another instead of interfering in parallel.

If session mode is not enabled, nb env use updates the global last env, and other sessions without session isolation are affected as well.

See nb session setup for how to enable it.