Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                

Set Active JFrog CLI Server

The active server is the default target for JFrog CLI commands when you do not pass --server-id or related environment overrides. jf config use switches that default to another configured server ID. The setting is persisted in your CLI configuration file.

This topic covers the following:

Synopsis

jf config use <server-id>

Aliases: none

Where:

  • <server-id>: The configured server ID to make active.

Arguments

The following table lists command arguments.

ArgumentRequiredDescription
server-idYesThe server ID to set as active

Flags

None.

Examples

Set the Active Server

To set the active server:

  1. Run the following command:

    jf config use <server-id>

    Where:

    • <server-id>: The server ID to use as the default.

    For example:

    jf config use staging-server

    Expected output:

    [Info] Using server ID 'staging-server'
  2. To confirm the change:

    Run the following command:

    jf config show

    You should see staging-server listed as Default: true.

Override the server for a single command or session

If you only need a different server for 1 command or for the current shell session, you do not have to change the global default.

To override the server for a single command:

  • Run the command with --server-id. The value must be a server ID you configured with jf config add.

    jf rt ping --server-id=<server-id>

    Where:

    • <server-id>: The server ID to use for this invocation only.

    For example:

    jf rt ping --server-id=prod-server

    The --server-id flag takes precedence over both the active server set by jf config use and the JFROG_CLI_SERVER_ID environment variable.

To override the server for the current terminal session:

  1. Export the environment variable:

    export JFROG_CLI_SERVER_ID=<server-id>

    Where:

    • <server-id>: Server ID to use until you close the shell or unset JFROG_CLI_SERVER_ID.

    For example:

    export JFROG_CLI_SERVER_ID=prod-server
  2. Run CLI commands as usual. They use prod-server without changing the active config stored by jf config use:

    jf rt ping

When to Use

Use jf config use when you have multiple server configurations (for example, dev-server, staging-server, prod-server) and want to switch the default for all subsequent commands.

Important Notes

  • The active server setting persists across sessions. It is stored in the configuration file (~/.jfrog/jfrog-cli.conf.v6).
  • Using --server-id on a command always overrides the active server for that command only.
  • The JFROG_CLI_SERVER_ID environment variable overrides the active server for the entire terminal session (until you close the terminal or run unset JFROG_CLI_SERVER_ID).
  • Concurrent sessions: All terminal sessions share the same configuration file. If multiple terminals run jf config use simultaneously, the last write wins and silently overrides earlier changes. For parallel or continuous integration and delivery (CI/CD) workflows, use --server-id or JFROG_CLI_SERVER_ID instead of switching the global active server.