docs/docs/en/api/cli/env/add.md
Save a named NocoBase API endpoint and switch the CLI to use that env. When oauth authentication is selected, nb env auth is started automatically.
This command does two things:
When session mode is enabled for the current shell or runtime, it updates the session current env. It also updates the global last env as the fallback for shells or runtimes without session mode.
nb env add [name] [flags]
| Parameter | Type | Description |
|---|---|---|
[name] | string | Environment name to save; prompted in TTY when omitted, required in non-TTY mode |
--verbose | boolean | Show detailed progress when writing config |
--locale | string | CLI prompt language: en-US or zh-CN |
--api-base-url, -u | string | NocoBase API URL, including the /api prefix |
--auth-type, -a | string | Authentication type: token or oauth |
--access-token, -t | string | API key or access token used with token authentication |
nb env add
nb env add local
nb env add local --api-base-url http://localhost:13000/api --auth-type oauth
nb env add local --api-base-url http://localhost:13000/api --auth-type token --access-token <token>