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
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.