docs/docs/en/api/cli/env/index.md
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 possiblelast env: the last env used globally, used as a fallback when session mode is not enablednb env <command>
| Command | Description |
|---|---|
nb env add | Save a NocoBase API endpoint and switch to this env |
nb env current | View the env that is currently in effect |
nb env update | Update a saved env configuration and automatically handle follow-up sync as needed |
nb env list | List configured envs |
nb env status | View the status of the current env, a specified env, or all envs |
nb env info | View detailed information for a single env |
nb env remove | Remove the env configuration after stopping the managed runtime |
nb env auth | Perform OAuth login for a saved env |
nb env use | Switch the current env |
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 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.