12.7. Switching Between Multiple OpenShift Environments

The client tools now support the environment variable OPENSHIFT_CONFIG, which overrides the default configuration file that the client tools will read from. This enables specifying only once the configuration file rather than having to specify it every time using the --config option. See Section 12.6, “Using Multiple OpenShift Configuration Files”. When you define the OPENSHIFT_CONFIG setting in your environment, the client tool will read the defined configuration file.

Procedure 12.3.  To Switch Between OpenShift Environments

  1. Set the OPENSHIFT_CONFIG environment variable under a bash shell using the following command:
    # export OPENSHIFT_CONFIG=bob
  2. Run rhc setup to create the new configuration file: ~/.openshift/bob.conf. Specify which broker server you want to connect to using the --server option:
    # rhc setup --server broker.example.com
  3. Verify that you are connected to the defined environment by running an rhc command:
    # rhc domain show
  4. Restore to default configuration by removing the value in OPENSHIFT_CONFIG with the following command:
    # export OPENSHIFT_CONFIG=

Note

Authentication tokens are stored locally based on the broker server and the username, so you do not need to sign in again as you switch between servers.
To check which broker server you are currently configured to use, run the following command:
# rhc account