nb env add

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:

  • Save the env configuration
  • Switch the current env to the newly added env

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.

Usage

nb env add [name] [flags]

Parameters

ParameterTypeDescription
[name]stringEnvironment name to save; prompted in TTY when omitted, required in non-TTY mode
--verbosebooleanShow detailed progress when writing config
--localestringCLI prompt language: en-US or zh-CN
--api-base-url, -ustringNocoBase API URL, including the /api prefix
--auth-type, -astringAuthentication type: token or oauth
--access-token, -tstringAPI key or access token used with token authentication

Examples

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>